Cod sursa(job #1795376)

Utilizator andreip0paAndrei Popa andreip0pa Data 2 noiembrie 2016 11:57:54
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <iostream>
#include <string.h>
#include <fstream>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{

    char s[1000]={};
    f.getline(s,1000);
    int nrcuv=0, media=0, lungim=0;
    for (int i=1;i<1000; i++){
        if (s[i]==' '  &&(( s[i+1]>'A' && s[i+1]<='Z') || (s[i+1]<'z' && s[i+1]>'a') )){
            nrcuv++;
        }
    }

     for (int i=1;i<1000; i++){
        if ((s[i]!=' ' && s[i]>'A' && s[i]<='Z' )|| (s[i]<'z' && s[i]>'a')){
            lungim++;

        }
    }


    media=lungim/nrcuv;
    g<<media;
    return 0;
}