Cod sursa(job #323076)
| Utilizator | Data | 10 iunie 2009 17:27:55 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.54 kb |
#include<cstdio>
#include<cstring>
#define maxn 2000007
using namespace std;
FILE *f=fopen("text.in","r");
FILE *g=fopen("text.out","w");
char a[maxn];
int i,n,p,k,ok;
int ch(char x)
{
if((x>='a'&&x<='z')||(x>='A'&&x<='Z'))
return 1;
return 0;
}
int main()
{
fgets(a,sizeof(a),f);
n=strlen(a);
for(i=0;i<n;++i)
if(ch(a[i])&&!ok) ok=1,++p,++k;
else if(ch(a[i])) ++k;
else ok=0;
fprintf(g,"%d\n",k/p);
fclose(f);
fclose(g);
return 0;
}
