Cod sursa(job #1379034)

Utilizator StarGold2Emanuel Nrx StarGold2 Data 6 martie 2015 15:50:36
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <fstream>
#include <cstring>
#define DIM 2000000
using namespace std;

ifstream fin ("text.in" );
ofstream fout("text.out");

int n, m, i, j, k, ok, minim, aux;
char s[DIM]; int nrcuv, nrlit;

int cond(){
     if((s[i] >= 'a' && s[i] <= 'z') || (s[i] >= 'A' && s[i] <= 'Z'))
          return 1;
     return 0;
}

void Code(){
     fin.get(s + 1, DIM);
     n = strlen(s + 1);
     s[n+1] = 1;
     ok = 1;
     for(i = 1; i <= n + 100; i ++){
          if(cond())
               aux ++;
          else{
               if(aux > 0)
                    nrcuv ++;
               nrlit += aux;
               aux = 0;
          }
     }
     fout << nrlit/nrcuv;
     return;
}

int main(){
     Code();
     return 0;
}