Cod sursa(job #1389488)
| Utilizator | Data | 16 martie 2015 12:21:15 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");ofstream fout("text.out");
int cuvinte,i,total,medie,l;
char text[1001];
int main()
{
fin.get(text,1001);
l=strlen(text);
if((text[1]>='a'&&text[1]<='z')||(text[1]>='A'&&text[1]<='Z')) cuvinte=2;
else cuvinte=1;
for(i=1;i<=l;i++)
{
if((text[i]>='a'&&text[i]<='z')||(text[i]>='A'&&text[i]<='Z')) total++;
if(text[i]==' ') cuvinte++;
}
medie=total/cuvinte;
fout<<medie;
return 0;
}
