Cod sursa(job #1558348)
| Utilizator | Data | 29 decembrie 2015 00:16:44 | |
|---|---|---|---|
| Problema | Text | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[100],*p,ss[100];
int l=0,nr=0;
int main ()
{
int i;
f.get(s,100);
f.get();
for(i=1;i<strlen(s);i++)
if(('a'<=s[i]&& s[i]>='z')||('A'<=s[i]&&s[i]>'Z'))
l++;
strcpy(ss,s);
p=strtok(ss," ,.-!?");
while (p!=NULL)
{
nr++;
p=strtok(NULL," ,.-!?");
}
g<<l/nr;
g.close();
return 0;
}
