Cod sursa(job #1429177)

Utilizator costi2Radu Canu costi2 Data 5 mai 2015 19:59:11
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.73 kb
#include <iostream>
#include <fstream>
#include <cctype>
#include <string.h>

using namespace std;


//#define FOR(i,a,b) for(i=a;b<=b;i++)
int spatiu(char y)
{
   if(isspace(y)==0)
    return 1;
   return 0;
}
int main()
{
    ifstream f("text.in");
    ofstream g("text.out");
    char x;

    char sir[100001];
    f.get(sir,10000);
    int ok=0;
    int lung = strlen(sir);
    int contor1=0;
    int contor2=0;
    for(int i = 0 ; i < lung ;i ++ )
       if(isalpha(sir[i]))
         {contor1++;

             if(ok==1)
                contor2++;
            ok=0;

         }
    else
        {ok=1;

        }
       if(contor2 == 0)
        g<<0;
       else
        g<<contor1/contor2;


}