|
|
back to boardwh Test 3 // Harry Poter #include <stdio.h> #include <iostream> #include <stdlib.h> #include <string.h> using namespace std; int main() { char line[200001], w2[200001]; cin.getline(line, sizeof(line)); int t = 0, i; for(i = 0; i < strlen(line); i++){ if (line[i] == line[i + 1]) { i++; A: if (line[i + 1] != line[i + 2]) { if (t != 0 && w2[t - 1] == line[i + 1]) {t--; i += 1; goto A;} } } else {w2[t++] = line[i];} } w2[t] = '\0'; printf("%s", w2); } |
|
|