Run Length Encode

Programming Interview Medium 4 views
Back to Questions

Problem Description

A string s is provided. Compress it using run-length encoding as: char followed by count (only when count>1). Output encoded string.

Input Format

One line s (no spaces).

Output Format

One line encoded.

Sample Test Case

Input:
aaabbc
Output:
a3b2c

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next