Cod sursa(job #1334350)
| Utilizator | Data | 4 februarie 2015 11:48:17 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 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=0;
bool ok;
getline (fin, s);
s+=' ';
for(int i=0; i<s.size(); i++){
if(isalpha(s[i])) total++, ok= true;
if(i==s.size()) break;
if(!isalpha(s[i+1]) && ok) words++, ok= false;
}
if(words==0) return 0;
fout << total/words;
return 0;
}
