Cod sursa(job #536409)
| Utilizator | Data | 18 februarie 2011 17:12:52 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<fstream>
#include<string>
#include<ctype.h>
using namespace std;
ifstream fin ("text.in");
ofstream fout ("text.out");
int main(){
char s[1001000],d=26;
int cv=0,i,slit=0,lit=0,n;
fin.get(s,1000999,d);
n=strlen(s);
if(isalpha(s[0])){
slit++;
cv++;
}
for(i=1;i<n;i++)
if(isalpha(s[i])){
slit++;
if(!isalpha(s[i-1])){
cv++;
}
}
if(cv==0) fout<<0;
else fout<<slit/cv;
}