Cod sursa(job #1402861)
Utilizator | Data | 26 martie 2015 21:35:02 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <fstream>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int nr,cuvinte;
char c,cop;
int main()
{
fin.get(c);
cop=c;
if ((c>='a' && c<='z') || (c>='A' && c<='Z'))
nr++;
while (fin.get(c))
{
if ((c>='a' && c<='z') || (c>='A' && c<='Z'))
nr++;
if ((c<'A' || (c>'Z' && c<'a') || c>'z') && ((cop>='a' && cop<='z') || (cop>='A' && cop<='Z')))
cuvinte++;
cop=c;
}
fout << nr / cuvinte;
return 0;
}