A simple Java program to compress a string by replacing repeated characters with the character and its count.
- Takes a string from the user
- Counts consecutive repeated characters
- Displays the compressed string
Java
String
Enter a string: aaabbcdddd Compressed string: a3b2c d4
V.Harini