#CT00039. Nén xâu (Run-Length Encoding)

    ID: 229 Loại: Thông thường 2000ms 256MiB Tried: 9 Đã chấp nhận: 5 Độ khó: 1 Đăng bởi: Nhãn>String AlgorithmsString processing basicsFundamentalsIteration techniquesImplementation techniques

Nén xâu (Run-Length Encoding)

Run-Length Encoding

Version: Phuoc Hung OJ Extended

Problem Statement

You are given a string SS consisting only of uppercase Latin letters from A to Z.

Split SS into maximal consecutive runs of equal characters. Encode each run by writing its character followed immediately by the number of occurrences in that run. The count must always be written, even when it is 11.

Construct the encoded string.

Input

A single line containing SS.

Output

Print the encoded representation of SS.

Subtasks

  • Subtask 1 (50 points): 1≤∣S∣≤1031 \le |S| \le 10^3.
  • Subtask 2 (50 points): 1≤∣S∣≤1061 \le |S| \le 10^6.
  • In every subtask, SS contains only A..Z.

Examples

Input

AAABCCCCDDDA

Output

A3B1C4D3A1

Explanation

The runs are AAA, B, CCCC, DDD, and A, with lengths 3,1,4,3,13,1,4,3,1 respectively. Therefore they are encoded as A3, B1, C4, D3, and A1, producing A3B1C4D3A1.