Decode Repeated Groups
Complete the function below. The function receives the full standard input as a single string and returns the exact standard output lines.
Problem
Decode strings that contain repeated parenthesized groups. Plain characters are copied directly. A group has the form (substring){k}, meaning the decoded substring inside the parentheses is repeated k times. Groups may be nested.
For each encoded string, output its decoded form.
Complete solveDecodeRepeatedGroups. It has one parameter, String input. The first line is q, followed by q encoded strings. Return one decoded string per query.
1Example 1
The second case decodes the nested group b(c){2} as bcc, then repeats it twice.
Constraints
Limits and guarantees your solution can rely on.
Repeat counts are non-negative integers written inside braces after a closing parenthesis.
Parentheses and braces are balanced in valid inputs.