Cod sursa(job #1257384)
| Utilizator | Data | 7 noiembrie 2014 18:23:55 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <iostream>
#include <fstream>
#include <string>
#include <ctype.h>
using namespace std;
string s;
unsigned long long lit=0,cuv=0,i=0;
int p=0;
long long cautcuv(){
long long sol=0;
while(!isalpha(s[i])&&i<s.size()) i++;
while(isalpha(s[i])&&i<s.size()) {sol++; i++;}
return sol;
}
int main()
{
ifstream in("text.in");
ofstream out("text.out");
getline(in,s);
long long x;
while(i<s.size()){
x=cautcuv();
if(x){
cuv++;
lit+=x;
}
}
out<<lit/cuv;
return 0;
}
