Run Length Encoding Problem

Run Length Encoding Problem — ExecCode School DSA Practice

Solve the Run Length Encoding problem on ExecCode. Free online school DSA practice in Strings - Basics. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given a string, perform run-length encoding on it. Your task is to solve Run Length Encoding. Replace consecutive identical characters with the character followed by its count.

Examples

Input aaabbc; Output a3b2c1. Input aabbcca; Output a2b2c2a1

Constraints

1<=len(S)<=10^4

Practice Run Length Encoding free on ExecCode. Browse DSA problems, topic map, and placement guides.