Cod sursa(job #793794)
Utilizator | Data | 4 octombrie 2012 10:25:54 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include<fstream>
#include<string>
using namespace std;
ifstream f("test.in");
ofstream o("test.out");
string mes;
char c;
int main()
{
getline(f,mes);
int words=1,totlength=0,i=0;
while(!((mes[i]>='A'&&mes[i]<='Z')||(mes[i]>='a'&&mes[i]<='z')))
{i++;}
for(;i<mes.length();i++)
{
if(mes[i]==' '||mes[i]=='-')
words++;
else
if((mes[i]>='A'&&mes[i]<='Z')||(mes[i]>='a'&&mes[i]<='z'))
totlength++;
}
o<<totlength/words;
return 0;
}