Cod sursa(job #818846)

Utilizator ionutzm05Marisca Mihai Ionut ionutzm05 Data 18 noiembrie 2012 09:35:32
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <string.h>
#include <fstream>
#include <cmath>
using namespace std;

int main()
{
    char s[100000],d[]=" -?!,",*p;
    int i,c=0,x=0;
    ifstream f("text.in");
    ofstream g("text.out");
    f.get(s,100);
    for(i=0;i<strlen(s);i++)
    {
        if(strchr("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",s[i])!=NULL)
          c++;
    }
    p=strtok(s,d);
    while(p)
    {
      x++;
      p=strtok(NULL,d);
    }
    g<<c/x;
    return 0;
}