Cod sursa(job #1526517)

Utilizator CodrutLemeniCodrut Lemeni CodrutLemeni Data 16 noiembrie 2015 20:11:01
Problema Text Scor 40
Compilator c Status done
Runda Arhiva de probleme Marime 0.61 kb
#include <stdio.h>
#include <stdlib.h>
#define A (ch>='A' && ch<='Z') || (ch>='a' && ch<='z')

char ch;
int nrlitere=0;
int nrcuv=0;
int mod;
int spy;


void verif(){
    if(ch=='\n' || mod==-1){
        printf("%d",nrlitere/nrcuv);
        exit(0);
    }
}


int main(){

    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);

    ch='\n';
    while(1){
        mod=scanf("%c",&ch);
        verif();

        if(A){
            nrlitere++;
            spy=1;
        }else if(spy==1){
            nrcuv++;
            spy=0;
        }


    }


    return 0;
}