Cod sursa(job #883944)

Utilizator oanaroscaOana Rosca oanarosca Data 20 februarie 2013 15:57:01
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <fstream>
#include <cmath>

using namespace std;

string s;
int l, i, cl, nrcuv;

int main () {
  ifstream fi("text.in");
  ofstream fo("text.out");
  getline (fi, s); l = s.length(); cl = l; cl--;
  for (i = 0; i <= cl; i++) {
    if ((s[i] < 65) or (s[i] > 122) or ((s[i] < 97) and (s[i] > 90)))
      l--;
  }
  for (i = 0; i <= cl-1; i++) {
    if (((s[i] >= 97) and (s[i] <= 122)) or ((s[i] >= 65) and (s[i] <= 90)))
      if ((s[i+1] < 65) or (s[i] > 122) or ((s[i] < 97) and (s[i] > 90))) {
        nrcuv++;
        do {
          i++;
        }
        while ((s[i] < 65) or (s[i] > 122) or ((s[i] < 97) and (s[i] > 90)));
      }
  }
  fo << trunc(l/nrcuv);
  return 0;
}