BubbleString
You are given a very, very long string. We will give you instructions what needs to be done with the string, and ask you to find out how the string will look after all these manipulations.
InputFirst line contains a string of uppercase English alphabet letters of length n, where 1 ≤ n ≤ 7100000.
Each other line contains a single command that affects the current string:
I,N,S - Insert string S of length s starting from index N, where 1 ≤ s ≤ 1000 and 0 ≤ N ≤ [current string length]-1;
D,N1,N2 - Delete substring starting from index N1, ending with index N2, where N1 ≤ N2;
F,N1,N2 - Flip (reverse) substring starting from index N1, ending with index N2, where N1 ≤ N2;
All string indices are zero-based and always represent a valid position within the current string.
Number of commands is k, where 0 ≤ k ≤ 10000.
Each other line contains a single command that affects the current string:
I,N,S - Insert string S of length s starting from index N, where 1 ≤ s ≤ 1000 and 0 ≤ N ≤ [current string length]-1;
D,N1,N2 - Delete substring starting from index N1, ending with index N2, where N1 ≤ N2;
F,N1,N2 - Flip (reverse) substring starting from index N1, ending with index N2, where N1 ≤ N2;
All string indices are zero-based and always represent a valid position within the current string.
Number of commands is k, where 0 ≤ k ≤ 10000.
OutputSingle line containing current string, after all commands are sequentially executed on input string.
Input:
GOWAYUP
I,5,ELB
I,5,BC
I,0,BU
D,2,6
F,3,6Output:
BUBBLECUP Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.