Cod sursa(job #1791623)
| Utilizator | Data | 29 octombrie 2016 15:51:26 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.59 kb |
#include<iostream>
#include<fstream>
#include<cstring>
using namespace std;
fstream fin("text.in",ios::in),fout("text.out",ios::out);
char x[1000],*p;
char litere[]="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPRSTUVWXYZ";
int main()
{
int s=0,nrc=0,n,i;
fin.getline(x,1000);
n=strlen(x);
for(i=0;i<n;i++)
{
if(strchr(litere,x[i])!=0)
{
s++;
}
}
p=strtok(x," -,!?;.");
while(p!=0)
{
nrc++;
p=strtok(0," -,!?;.");
}
fout<<s/nrc;
fin.close();
fout.close();
return 0;
}
