Cod sursa(job #879608)

Utilizator TamasanPaulTamasan Paul Alexandru TamasanPaul Data 15 februarie 2013 17:53:59
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.71 kb
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
    ifstream f("text.in");
    ofstream g("text.out");
    char prop[100];
    f.get(prop,100);
    int i, nrCuvinte=0, lungime=strlen(prop), asciiCode;
    for(i=0; i<lungime; i++) {
        asciiCode=(int)prop[i];
        if((asciiCode>64 && asciiCode< 91) || (asciiCode>96 && asciiCode<123)) {
        nrCuvinte++;
        strcpy(prop+i,prop+1+i);
        }   
    }
    asciiCode=(int)prop[lungime];
    if((asciiCode>64 && asciiCode< 91) || (asciiCode>96 && asciiCode<123)) {
        nrCuvinte++;
        g<<strlen(prop)/nrCuvinte;
        }
    else {
        nrCuvinte++;
        g<<(strlen(prop)-1)/nrCuvinte;
    }
    return 0;
}