|
|
back to boardac 0.015 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cmath> #include <algorithm> #include <set> #include <vector> #include <string> #include <cstdlib> using namespace std; void optimization() { cin.tie(nullptr); ios_base::sync_with_stdio(false); } int main() { optimization(); string s; int k = -1; cin >> s; char c[200000]; for (char & i : c) { i = ' '; } for (char i : s) { if (k > -1) { if (c[k] == i) { c[k] = ' '; k--; } else { k++; c[k] = i; continue; } } else { k++; c[k] = i; } } for (char i : c) { if (i != ' ') { cout << i; } } return 0; } |
|
|