String Compression
easy
1. You are given a string. 2. You have to compress the given string in the following two ways - First compression -> The string should be compressed such that consecutive duplicates of characters are replaced with a single character. For "aaabbccdee", the compressed string will be "abcde". Second compression -> The string should be compressed such that consecutive duplicates of characters are replaced with the character and followed by the number of consecutive duplicates. For "aaabbccdee", the compressed string will be "a3b2c2de2".
Constraints
1 <= length of string <= 1000
Format
Input
A String
Output
Two strings representing first compressed string and second compressed string respectively.
Example
Sample Input
wwwwaaadexxxxxx
Sample Output
wadex
w4a3dex6
Question Video