Cod sursa(job #1535428)

Utilizator WinnerMCroitorescu Madalin WinnerM Data 24 noiembrie 2015 19:12:56
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <iostream>
#include<bits/stdc++.h>

using namespace std;
ifstream f("text.in");
ofstream g("text.out");
int main()
{
    char text[256],v[]=",.!?-:;",*sp,*q,k=0;
    int lung_text=0,nr_cuv=0;
    f.get(text,256);
   while(k<=strlen(text)-1 && (strchr(v,text[k]) || text[k]==' '))
   {
       k++;
   }
   strcpy(text,text+k);
   if(strchr(v,text[strlen(text)-1]))
       text[strlen(text)-1]=NULL;
    for(int i=0;i<=strlen(text)-1;i++)
    {
       if(('a'<=text[i] && text[i]<='z') || ('A'<=text[i] && text[i]<='Z'))
            lung_text++;
        else
        {
            nr_cuv++;
        }
    }

   g<<lung_text/nr_cuv;

}