Cod sursa(job #1561750)
| Utilizator | Data | 4 ianuarie 2016 15:02:07 | |
|---|---|---|---|
| Problema | Text | Scor | 60 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <iostream>
#include <fstream>
#include <cstring>
#include <cctype>
using namespace std;
char s[100000000];
int nr,len;
char sep[]=" -.,<>?/\\;:\'\"!~";
int main()
{
ifstream fin("text.in");
char c=fin.get();
bool word=0;
while(!fin.eof())
{
if(isalpha(c))
{
++len;word=1;
}
if(strchr(sep,c) && word==1)
{
++nr;
word=0;
}
c=fin.get();
}
ofstream fout("text.out");
fout<<len/nr;
return 0;
}
