Cod sursa(job #2911993)

Utilizator Rares1231Gheorghe Rares Rares1231 Data 6 iulie 2022 13:32:40
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <fstream>
#include <cstring>

using namespace std;

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

int main(){

    int nrcuv=0, lungime_prop=0;
    char a[256], *p;
    fin.getline(a, 256);
    for(int i=0;a[i]!='\0';i++){
        if(a[i]>='a' && a[i]<='z')
            lungime_prop++;
        else if(a[i]>='A' && a[i]<='Z')
            lungime_prop++;
        else continue;
    }
    p=strtok(a, " -,!.?;");
    while(p){
        nrcuv++;
        p=strtok(NULL, " -,!.?;");
    }
    int k;
    k=lungime_prop/nrcuv;
    fout<<k;
    return 0;
}