#include #include #include using namespace std; #define LEFT 1 #define UP 2 #define SIKMO 3 struct Prvek{ int c; int smer; }; int main () { char p1[1000][11]; char p2[1000][11]; char sl[11]; Prvek pr[1001][1001]; int c1=0, c2=0; cin >> sl; while(true) { while(strcmp(sl,".")) { strcpy(p1[++c1],sl); cin >> sl; cin.ignore(); cout<> sl; while(strcmp(sl,".")) { strcpy(p2[++c2], sl); cin >> sl; cin.ignore(); cout< s; while (c1>0 && c2>0) { if (pr[c1][c2].smer == LEFT) s.push(p2[c2--]); else if (pr[c1][c2].smer == UP) s.push(p1[c1--]); else { s.push(p2[c2--]); c1--; } } while (!s.empty()) { cout << s.top() << " "; s.pop(); } cout << "." << endl; cin >> sl; if(!strcmp(sl, ".")) return 0; } return 0; }