Cod sursa(job #550999)
| Utilizator | Data | 10 martie 2011 10:59:01 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include <fstream.h>
#include <string.h>
char s[3000005];
long long nc,nt,nr,i,sw;
int main()
{
ifstream fin("text.in");
fin.get(s,3000005,'\n');
i=0;
while(i<strlen(s))
{
while((s[i]<'a' || s[i]>'z') && (s[i]<'A' || s[i]>'Z') && i<strlen(s))
i++;
sw=0;
while((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z') && i<strlen(s))
{
i++;
nr++; sw=1;
}
nt+=nr;
if(sw)
nc++;
nr=0;
}
fin.close();
ofstream fout("text.out");
fout<<nt/nc;
fout.close();
return 0;
}
