Cod sursa(job #1251737)
| Utilizator | Data | 29 octombrie 2014 21:00:30 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main(){
string str;
freopen("text.in", "r", stdin);
freopen("text.out", "w", stdout);
std::getline(std::cin, str);
int len = str.size(), letters = 0, words = 0, k = 0;
for(int i = 0; i < len; i++){
if(isalpha(str[i])){
if(k == 0){
words++;
k = 1;
}
letters++;
}else{
k = 0;
}
}
if(words == 0)
printf("0\n");
else
printf("%d\n", letters/words);
return 0;
}
// 4746746547
