Cod sursa(job #1935012)
| Utilizator | Data | 21 martie 2017 22:41:31 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.75 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char S[2000010],sep[]="1234567890,.;?! :-";
int nrcuv,lgtotal;
int main()
{
fin.getline(S,2000010);
char *p=strtok(S,sep);
while(p!=0)
{
int k=0,m=strlen(p);
for( ;k<m;k++)
{
if(isalpha(p[k])==0)
while(isalpha(p[k])==0&&k<m)
k++;
if(isalpha(p[k])!=0)
{
nrcuv++;
while(isalpha(p[k])!=0&&k<m)
{
lgtotal++;
k++;
}
}
}
p=strtok(NULL,sep);
}
fout<<lgtotal/nrcuv;
return 0;
}
