Cod sursa(job #743357)
| Utilizator | Data | 3 mai 2012 23:24:53 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<iostream>
#include<fstream>
#include<string.h>
using namespace std;
int main ()
{
ifstream f("text.in");
ofstream g("text.out");
char s[3],z[3];
int nrcuv=0,l=0;
z[0]=NULL;
while(f.get(s,2))
{
if(isalpha(s[0]))++l;
if(isalpha(s[0]) and !isalpha(z[0]))++nrcuv;
z[0]=s[0];
}
g<<l/nrcuv<<"\n";
f.close();
g.close();
return 0;
}