Pagini recente » Cod sursa (job #1358911) | Cod sursa (job #2262190) | Cod sursa (job #1488634) | Cod sursa (job #294159) | Cod sursa (job #1333575)
#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);
for(int i=0; i<s.size(); i++){
if(isalpha(s[i])) total++, ok= true;
if(!isalpha(s[i+1]) && ok) words++, ok= false;
}
fout << total/words;
return 0;
}