Cod sursă (job #93024)

Utilizator avatar P_ERROR Pangratie Andrei P_ERROR IP ascuns
Problemă Bart (clasele 9-10) Compilator cpp | 0,47 kb
Rundă Tema 8 clasele 9-10 2014/15 Status evaluat
Dată 28 nov. 2014 14:09:05 Scor 0
#include <iostream>
#include <fstream>
#include <cstdlib>

using namespace std;

const int Nmax = 500003;

char str[Nmax];

int main()
{
    ifstream f("bart.in");
    ofstream gd("bart.out");

    f >> str;
    int N = 0;
    while( str[N++] );

    exit(N);

    int g=1;

    for(int i=0;i<N-1;i++)
    {
        if(str[i]!=str[i%g])
        {
            g=i+1;
        }
    }

    for(int i = 0; i < g ; i++){
        gd << str[i];
    }
    gd << endl;

    return 0;
}