#K78182. Run-Length Title Encoding
Run-Length Title Encoding
Run-Length Title Encoding
Given a title string, encode it by replacing consecutive occurrences of characters with the character followed by the number of times it appears consecutively. For example, the title book
is encoded as b1o2k1
. If the title is empty, simply output an empty string.
The program should also support processing multiple titles. The first line of input contains an integer N (with N ≥ 1), which represents the number of titles. Each of the following N lines contains one title. The output should contain the encoded result for each title on a separate line.
inputFormat
The first line of input contains an integer N representing the number of titles. This is followed by N lines, each containing a title string (which may be empty) that needs to be encoded.
outputFormat
For each title, output its encoded form on a separate line. The encoding rule is to replace each sequence of consecutive identical characters with the character and the count of its repetitions.
## sample1
a
a1
</p>