Cod sursa(job #1399067)

Utilizator DysKodeTurturica Razvan DysKode Data 24 martie 2015 15:54:13
Problema Text Scor 30
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <fstream>
#include <cstring>

using namespace std;

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

int i,j,n,l;
char s[200000];

int main()
{
    fin.get(s,199999);

    l = strlen( s );

    for( i = 1 ; i < l ; ++i )
    {
        if( s[ i ] >= 'a' && s[ i ] <= 'z' || s[ i ] >= 'A' && s[ i ] <= 'Z' )
        {
            if( n % 2 == 0 )
                ++n;
            ++j;
        }
        else
        {
            if( n % 2 == 1 )
                ++n;
        }
    }
    n /= 2;
    fout<<j/n;

return 0;
}