|
|
вернуться в форумWhy I WA 6 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N = 250009; char s[N]; int main() { scanf("%s", s); int len, i, j; len = strlen(s); for (i = 1, j = 0; i < len; ++i) { if (s[i] == s[j]) { s[i] = 96; s[j] = 96; i++; while (s[j] == 96) j--; while (j>=0 && i<len && s[i] == s[j]) { s[j] = 96; s[i] = 96; j--; i++; } j = i; } else j = i; } for (i = 0; i < len; ++i) if (s[i] != 96) printf("%c", s[i]); printf("\n"); return 0; } |
|
|