Push contents of both stacks in result
res = [ ] NEW_LINE while len ( s1 ) != 0 : NEW_LINE INDENT res . append ( s1 [ - 1 ] ) NEW_LINE s1 . pop ( ) NEW_LINE DEDENT while len ( s2 ) != 0 : NEW_LINE INDENT res . append ( s2 [ - 1 ] ) NEW_LINE s2 . pop ( ) NEW_LINE DEDENT