Cod sursa(job #1251749)
| Utilizator | Data | 29 octombrie 2014 21:06:31 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.44 kb |
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main(){
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
int letters = 0, words = 0, k = 0;
char c;
while((c = getchar())!= EOF){
if(isalpha(c)){
if(k == 0){
k = 1;
words++;
}
letters++;
}else{
k = 0;
}
}
if(words == 0)
printf("0\n");
else
printf("%d\n", letters/words);
return 0;
}
