Cod sursa(job #734845)

Utilizator shuleavSulea Vlad shuleav Data 14 aprilie 2012 23:19:02
Problema Text Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int l,nc,cuv;
char s,ant;
bool litera(char x){
    if ((x>='a' && x<='z') || (x>='A' && x<='Z')) return true;
    return false;
}
int main(){
    while(f.get(s)){
         if (litera(s)) l++;
         if (litera(s)==true && litera(ant)==false) cuv++;
    ant=s;
    }
    g<<l/cuv<<'\n';
    f.close();
    g.close();
    return 0;
}