Cod sursa(job #1795372)

Utilizator andreip0paAndrei Popa andreip0pa Data 2 noiembrie 2016 11:48:16
Problema Text Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.62 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]==' ' && i!=1 &&(s[i]!=' ' && s[i]>'A' && s[i]<='Z' )|| (s[i]<'z' && s[i]>'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++;

        }
    }
    nrcuv-=1;

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