#include #include using namespace std; int main() { char a, b; list input; list output; while(1) { // Read the input while(scanf("%c", &a) == 1 && a != '\n') { input . push_back(a - '0'); } if(input.empty()) { return 0; } // Vysetrovani dvojic while( true ) { // Nacteni dvojice ab (v opacnem poradi - zasobnik) if( ! input.empty()) { b = input.back(); input.pop_back(); } else { b = 0; } output.push_back( !b ); if( b == 0 ) { break; } if( ! input.empty() ) { a = input.back(); input.pop_back(); } else { a = 0; } if( a == 1 ) { break; } output.push_back( !a ); } // Vypis while(! input.empty()) { printf("%c", '0' + input.front()); input.pop_front(); } while(! output.empty()) { printf("%c", '0' + output.back()); output.pop_back(); } printf("\n"); } return 0; }