#K84547. Taco String Encoding

    ID: 36443 Type: Default 1000ms 256MiB

Taco String Encoding

Taco String Encoding

Given a string s, encode it by counting the number of times each character appears consecutively. For example, for a string s where consecutive appearances of a character c appear n times, the encoded format is cn. More formally, if the string is represented as $$s = c_1c_2\ldots c_k$$, then the encoded string is obtained as:

Encoded(s)=for each block (c,n),  cnEncoded(s)=\text{for each block }(c, n), \; c\, n

For instance:

  • If the input is aabcccccaaa, the output must be a2b1c5a3.
  • If the input is abc, the output must be a1b1c1.

Your task is to implement the encoding function that performs this transformation.

inputFormat

The input consists of a single line containing the string s (which can include letters, digits, or symbols). The length of s can be up to 100,000 characters. Input is read from stdin.

outputFormat

Output the encoded string as described. The answer should be written to stdout.

## sample
aabcccccaaa
a2b1c5a3