Want to solve this problem? Login now to get access to solve the problems

Problem

Submissions

Solution

Leaderboard

Coming soon

4

Difficulty: MEDIUM

Avg. time to solve

25 min

Success Rate

60%

Problem Statement

Suggest Edit

```
If a string has 'x' repeated 5 times, replace this "xxxxx" with "x5".
The string is compressed only when the repeated character count is more than 1.
```

```
Consecutive count of every character in the input string is less than or equal to 9.
```

```
The first and only line of input contains a string without any leading and trailing spaces.
```

```
The only line of output prints the updated string.
```

```
You are not required to print anything. It has already been taken care of, just implement the function.
```

```
1 <= N <= 10^6
Where N is the length of the input string.
Time Limit: 1 second
```

```
aaabbccdsa
```

```
a3b2c2dsa
```

```
aaabbcddeeeee
```

```
a3b2cd2e5
```

Want to solve this problem? Login now to get access to solve the problems