Cod sursa(job #2627593)

Utilizator alex_benescuAlex Ben alex_benescu Data 11 iunie 2020 14:20:52
Problema Text Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <stdio.h>
using namespace std;
int main(){
  freopen("text.in", "r", stdin);
  freopen("text.out", "w", stdout);
  char c, cant;
  int a=0, b=0;
  cant=fgetc(stdin);
  if((cant>='a' && cant<='z') || (cant>='A' && cant<='Z')){
    a++;
    b++;
  }
  c=fgetc(stdin);
  while(c!=EOF){
    if(((cant<'a' || cant>'z') && (cant<'A' || cant>'Z')) && ((c>='a' && c<='z') || (c>='A' && c<='Z')))
      b++;
    if((c>='a' && c<='z') || (c>='A' && c<='Z'))
      a++;
    cant=c;
    c=fgetc(stdin);
  }
  printf("%d\n", a/b);
  return 0;
}