Cod sursa(job #1095930)

Utilizator StranycAlexandru K. Stranyc Data 1 februarie 2014 11:21:05
Problema Text Scor 70
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.91 kb
#include <iostream>
#include <fstream>
#include <string>
#include <string.h>
using namespace std;
ifstream fi("text.in");
ofstream fo("text.out");
int main()
{   int sum=0,k=0;
    string s;
    while(!fi.eof()){
                     getline(fi,s);
                     int i=0;
                     while(i<s.length()){
                                         if(isalpha(s[i]) && i<s.length()){
                                                           sum++;
                                                           while(i<s.length() && isalpha(s[i])) {sum++; i++;}
                                                           i++;
                                                           k++;
                                                           }
                                         i++;
                                         }
                     }
    fo<<(sum-2)/k;
    cin>>s;
}