akshitagit / akshitagit/Python

Strings Compression

Open
#47 6 comments 0 reactions 0 assignees View on GitHub
algorithms datastructures DSA hacktoberfest hacktoberfest2020 hactoberfest Strings
Dominant language
Python
Stars
124
Forks
109
PR merge metrics
No merged PRs in 30d

Description

Take as input S, a string. Write a function that does basic string compression. Print the value returned. E.g. for input “aaabbccds” print out a3b2c2d1s1.
Input Format

A single String S
Constraints

1 < = length of String < = 1000
Output Format

The compressed String.
Sample Input

aaabbccds

Sample Output

a3b2c2d1s1

Explanation

In the given sample test case 'a' is repeated 3 times consecutively, 'b' is repeated twice, 'c' is repeated twice and 'd and 's' occurred only once.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.