Cod sursa(job #2501612)

Utilizator bucilamihai.iWNLMihai Cristian bucilamihai.iWNL Data 30 noiembrie 2019 00:07:33
Problema Text Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include<fstream>
#include<cstring>
using namespace std;

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

int main()
{
    char s[256],*p;
    int nrlitere=0,k=0;
    fin.get(s,256);
    for(int i=0;i<strlen(s);i++)
        if(s[i]>='a' && s[i]<='z' || s[i]>='A' && s[i]<='Z')
            nrlitere++;
    p=strtok(s," !%&()+,-./0123456789:;<=>?{|}~");
    while(p)
    {
        k++;
        p=strtok(NULL," !%&()+,-./0123456789:;<=>?{|}~");
    }
    fout<<nrlitere/k;
}