Description
編碼(Encoding)是將信息從一種格式轉換為另一種格式的過程。現今有很多不同類型的編碼方案,在此問題中,我們將討論一種非常簡單的編碼技術。
遊程編碼 (Run-length encoding) 是一種非常簡單的數據壓縮形式,其中將連續出現相同字符替換為單個字符,並且加上其出現頻率。例如,字符串"AABBBBDAA"將被編碼為"A2B4D1A2"。
在此問題中,我們感興趣的是解碼(Decoding)使用上述過程編碼的字符串。
Encoding is the process of transforming information from one format into another. There exist several different types of encoding scheme. In this problem we will talk about a very simple encoding technique; Run-Length Encoding.
Run-length encoding is a very simple and easy form of data compression in which consecutive occurrences of the same characters are replaced by a single character followed by its frequency. As an example, the string ‘AABBBBDAA’ would be encoded to ‘A2B4D1A2’, quotes for clarity.
In this problem, we are interested in decoding strings that were encoded using the above procedure.
Input
輸入的第一行是整數T (T < 50),它代表測試數量。接下來T行,每行一個字符串,代表使用遊程編碼後的字符串。
該字符串僅包含數字[0 - 9]和字母[A - Z]。不會有不合理的輸入
The first line of input is an integer T (T < 50) that indicates the number of test cases. Each case is a line consisting of an encoded string. The string will contain only digits [0-9] and letters [A-Z].
Every inputted string will be valid. That is, every letter will be followed by 1 or more digits.
Output
對於每種情況,輸出測試編號,然後輸出解碼後的字符串。
解碼後的字符串的長度不會大於200,並且只會包含大寫字母。
For each case, output the case number followed by the decoded string. Adhere to the sample for exact format.
You may assume the decoded string wont have a length greater than 200 and it will only consist of upper case alphabets.
Sample Input 1
3
A2B4D1A2
A12
A1B1C1D1
Sample Output 1