## 20 Feb PMCA Saturday 18:30 Python Homework 20.02.15.

**Question:**

You have come up with the following compression technique: for each symbol, write down the number of times it appears consecutively, followed by the symbol itself. This compression technique is called run-length encoding.

Given a sequence of characters, write a program to encode them in this format: The encoding of a line will be a sequence of pairs, separated by a space, where each pair is an integer (representing the number of times the character appears consecutively) followed by a space, followed by the character.

**Sample Input 1:**

+++===!!!!

**Output for Sample Input 1:**

3 + 3 = 4 !

**Explanation of Output for Sample Input**

To see how the first message (on the second line of input) is encoded, notice that there are 3 + symbols, followed by 3 = symbols, followed by 4 ! symbols.

**Sample Input 2:**

777777……TTTTTTTTTTTT

**Output for Sample Input 2:**

6 7 6 . 12 T

Sorry, the comment form is closed at this time.