Cod sursa(job #488029)
| Utilizator | Data | 27 septembrie 2010 13:56:07 | |
|---|---|---|---|
| Problema | Text | Scor | 60 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int esteLitera(char c){
if (c>='A' && c<='Z')
return 1;
if (c>='a' && c<='z')
return 1;
if (c>='0' && c<='9')
return 1;
return 0;
}
int main()
{
char a, b = 0;
int p = 0, n = 0;
b=fin.get();
while( (a=fin.get())!=EOF)
{
if ( esteLitera(a))
n++;
else
if ( esteLitera(b))
p++;
b = a;
}
fout << n/p;
fin.close();
fout.close();
return 0;
}
