Cod sursa(job #1097161)

Utilizator NaniteNanite Nanite Data 3 februarie 2014 03:14:04
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <fstream>
#include <cctype>
#include <cstring>

using namespace std;

int main()
{
    ifstream in("text.in");
    char s[10000];
    unsigned int l, tl = 0, se = 0;

    in.getline(s, 10000);

    l = strlen(s);
    if(isalpha(s[0])) {
        se++;
    }
    for(unsigned int i = 0; i < l; i++) {
        if(isalpha(s[i])) {
            tl++;
        } else if(isalpha(s[i+1])){
            se++;
        }
    }
    ofstream out("text.out");
    out << tl/se;

    return 0;
}