Cod sursa(job #1097160)

Utilizator NaniteNanite Nanite Data 3 februarie 2014 03:12:06
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 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);
    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+1);

    return 0;
}