Run length encoding of a string

Given a string, you need to count the consecutive characters and show the count in the string for each character. If there is only one character, you dont need to show the count. public class Answer implements RunLengthEncodingInterface { @Override public String DoRunLengthEncoding(String str) { // WRITE YOUR CODE HERE return ; } public static void main(String [] args) { // write code here to test } } Example1: Input: "aaaabbbcddddaa" Output:"a4b3cd4a2"

Answer

No comments:

Post a Comment