#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; } output.push_back( !a ); if( a == 1 ) { break; } } // Vypis bool first = true; while(! input.empty()) { if(input.front() == 1) first = false; if(!first) printf("%c", '0' + input.front()); input.pop_front(); } first = true; while(! output.empty()) { if(output.back() == 1) first = false; if(!first) printf("%c", '0' + output.back()); output.pop_back(); } if(first == true) printf("0"); printf("\n"); } return 0; }