# | Problem | Pass Rate (passed user / total user) |
---|---|---|
11417 | String Operation |
|
Description
Given a set of strings, perform the operations according to the following commands, and output the final result of the given set of strings.
Commands:
s n m: Swap the nth string and the mth string.
i n m: Insert the mth string at the tail of the nth string.
si n m: Swap the specified strings first, and then insert.
is n m: Insert first, and then swap the two specified strings.
e: Exit.
Consider a set of strings:
ab
cd
ef
And a sequence of commands:
s 0 1
i 1 2
The result will be:
cd
abef
ef
You will be provided with main.cpp and function.h, and asked to implement function.cpp.
Input
The first line is an integer N indicating the number of input strings.
The following N lines each contains one input string.
Starting from the N+2th line will be a sequence of commands.
Output
Output the final result of the input strings.