Cod sursa(job #884850)
| Utilizator | Data | 21 februarie 2013 13:34:36 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include<fstream>
#include<cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char a[20001];
char *w;
int i,nr=0,l,nrc=0;
int main()
{
int ok=0;
f.getline(a,20001);
l=strlen(a);
for(i=0;i<l;i++)
{
if((a[i]>='a'&& a[i]<='z')||(a[i]>='A' && a[i]<='Z'))
{
nrc++;
ok=1;
}
else
{
if(ok==1)
{
nr++;
ok=0;
}
}
}
/* w=strtok(a," ?:!+;(),.-");
while(w!=NULL)
{
nr++;
w=strtok(NULL, " ?:!+;(),.-");
}*/
g<<nrc/nr;
return 0;
}
