Java compressing Strings

前端 未结 20 1082
误落风尘
误落风尘 2020-11-29 09:24

I need to create a method that receives a String and also returns a String.

Ex input: AAABBBBCC

Ex output: 3A4B2C

Well, this is quite embarrassing a

20条回答
  •  余生分开走
    2020-11-29 10:07

    public class StringCompression {
        public static void main(String... args){
            String s="aabbcccaa";
            //a2b2c3a2
    
            for(int i=0;i

提交回复
热议问题