Cod sursa(job #3173026)

Utilizator maftenoMaftei Alex-Cristian mafteno Data 21 noiembrie 2023 18:42:11
Problema Litere Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <bits/stdc++.h>

using namespace std;

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

char a[1000001];

int main() {
    int n, i, j;
    char ch;
    fin >> n;
    j = 0;
    while ( fin >> a )
    {
        if ( a[j] == ch && j > 0)
        {
            j --;
            a[j] = '\0';
        }
        a[j] = ch;
        j ++;
    }
    for ( i = 1; i <= j; ++i ) fout << a[i];
    return 0;
}