#K73247. Decoding Encoded Strings
Decoding Encoded Strings
Decoding Encoded Strings
In this problem, you are given encoded strings that follow a specific pattern. Each encoded string consists of a sequence of letter-digit pairs. For each pair, the letter is repeated a number of times equal to the digit that follows it. Formally, an encoded string S can be represented as:
where each letter (which can be uppercase or lowercase) is immediately followed by a single digit (in the range 0-9). The decoded string is the concatenation of each letter repeated times, i.e.,
$$decoded\ string = x_1^{n_1} || x_2^{n_2} || \dots || x_k^{n_k} $$Your task is to decode multiple encoded strings provided via standard input and output the decoded strings, each on a separate line.
inputFormat
The input is read from standard input and has the following format:
- The first line contains an integer T, the number of test cases.
- Each of the following T lines contains one encoded string.
Each encoded string consists of alternating characters and digits.
outputFormat
For each test case, output the decoded string on a new line. The output should be written to standard output.## sample
3
a2B3
P1h2G4
x2Y3z1
aaBBB
PhhGGGG
xxYYYz
</p>