Cod sursa(job #900088)
| Utilizator | Data | 28 februarie 2013 17:35:57 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 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[1000002];
int cifra(int x)
{
if (x>='a' && x<='z' || x>='A' && x<='Z')
return 0;
return 1;
}
int main()
{
f.getline(s,1000002);
n=strlen(s);
for (i=0;i<n;i++)
{
if (cifra(s[i])==1 && cifra (s[i+1])==0)
nrc++;
if (cifra(s[i])==0)
l++;
}
if (cifra(s[0])==0)
nrc++;
if (nrc!=0)
g<<l/nrc;
else
g<<l;
f.close();
g.close();
return 0;
}
