Cod sursa(job #1577578)

Utilizator popasergiu99Popa Sergiu-Nicolae popasergiu99 Data 23 ianuarie 2016 16:12:59
Problema Text Scor 40
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;

int main()
{
    ifstream f ("text.in");
    ofstream g ("text.out");
   char s[10000],sep[]=" .,?!`~*)(",*p,l[]="qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM";
   f.getline(s,10000);
   int i,k=0,m=0;
   p=strtok(s,sep);
   while (p)
   {
       k++;
       for (i=0;i<strlen(p);i++)
       {
           if (strchr(l,p[i]));
            m++;
       }
       p=strtok(NULL,sep);
   }
   g<<m/k;
   g.close();
}