Cod sursa(job #1097158)

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

using namespace std;

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

    in.getline(s, 256);

    l = strlen(s);
    for(unsigned int i = 0; i < l; i++) {
        if(isalpha(s[i])) {
            tl++;
        } else {
            if(tl) {
                se++;
            }
        }
    }

    ofstream out("text.out");
    out << tl/se;

    return 0;
}