Cod sursa(job #1332664)
Utilizator | Data | 2 februarie 2015 11:49:04 | |
---|---|---|---|
Problema | Text | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
string s;
int main(){
int total=0, words=1;
bool ok;
getline (fin, s);
for(int i=1; i<s.size(); i++){
if((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z'))
total++, ok=true;
else if(ok && ((s[i-1]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z')))
words++, ok=false;
}
fout << total/words;
return 0;
}