Cod sursa(job #1247425)
| Utilizator | Data | 22 octombrie 2014 20:05:08 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int sum;
string text;
char *pointer;
int main() {
getline(f, text);
int length = text.length(), i = 0, no = 0, sum = 0;
const char *pointer = text.c_str();
while(i < length)
{
if(isalpha(pointer[i]))
no++;
while(isalpha(pointer[i]))
{
sum++;
i++;
}
i++;
}
g << sum / no;
f.close();
g.close();
return 0;
}
