Cod sursa(job #905572)
| Utilizator | Data | 5 martie 2013 22:17:20 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<fstream>
#include<cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
string s;
inline void citire()
{
getline(fin, s);
}
int main()
{
citire();
int nr_cuv = 0, litere = 0;
for(int i = 0; i < s.length(); ++i)
{
if((s[i] >= 'a' and s[i] <= 'z') or (s[i] >= 'A' and s[i] <= 'Z'))
{
nr_cuv++;
while((s[i] >= 'a' and s[i] <= 'z') or (s[i] >= 'A' and s[i] <= 'Z'))
{
++litere;
++i;
}
}
}
int sol = litere / nr_cuv;
fout << sol;
return 0;
}
