Cod sursa(job #900131)
| Utilizator | Data | 28 februarie 2013 17:48:52 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.45 kb |
#include <fstream>
#include <string.h>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
long i,j,n,nrc,l;
char s;
int cifra(int x)
{
if (x>='a' && x<='z' || x>='A' && x<='Z')
return 0;
return 1;
}
int main()
{
while (f.get(s))
{
if (cifra(s)==1 && n==1)
{
nrc++;
n=0;
}
if (cifra(s)==0)
{
l++;
n=1;
}
}
if (nrc!=0)
g<<l/nrc;
else
g<<l;
f.close();
g.close();
return 0;
}
