Cod sursa(job #2297315)
| Utilizator | Data | 5 decembrie 2018 18:35:58 | |
|---|---|---|---|
| Problema | Text | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int n,s;
int main()
{int i,w = 0;
bool ok = 0;
char t[100000];
char c[1000000];
fin.getline(c,1000000);
int m = strlen(c);
for(i = 0; i < m; ++i)
if(isalpha(c[i]))
{s++;
if(!isalpha(t[w]) && ok)
{n++;
w = 0;
ok = 0;
}
}
else
{t[++w] = c[i];
ok = 1;
}
if(n == 0)
{fout<<0;
return 0;
}
fout<<s/n;
fin.close();
fout.close();
return 0;
}
