Cod sursa(job #1878639)
| Utilizator | Data | 14 februarie 2017 12:36:34 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.48 kb |
#include <fstream>
#include <cstring>
using namespace std;
char s[1001],*p;
ifstream f("text.in");
ofstream g("text.out");
int nrcuv,lit;
int main()
{
f.getline(s,100);
p=strtok(s," -;,:?!");
while(p)
{
nrcuv++;
for(int i=0;i<strlen(p);i++)
if((p[i]>='a' && p[i]<='z') || (p[i]>='A' &&p[i]<='Z'))
lit++;
p=strtok(NULL," -;,:?!");
}
g<<lit/nrcuv;
f.close();g.close();
return 0;
}
