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.
input = "3\nabs(cs){3}g\na(b(c){2}){2}\nx(yz){0}q"
return = ["abscscscsg","abccbcc","xq"]The second case decodes the nested group b(c){2} as bcc, then repeats it twice.
Repeat counts are non-negative integers written inside braces after a closing parenthesis.
Parentheses and braces are balanced in valid inputs.
public String[] solveDecodeRepeatedGroups(String input) {
// write your code here
}