Cod sursa(job #1379011)

Utilizator StarGold2Emanuel Nrx StarGold2 Data 6 martie 2015 15:40:37
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;
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 + 1; i ++){
          if(cond())
               nrlit ++;
          if(cond() && ok == 1){
               nrcuv ++;
               ok = 0;
          }
          if(cond() == 0)
               ok = 1;
     }
     fout << nrlit/nrcuv;
     return;
}

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