public static String zipString(String str){ String result = "";//用于拼接新串的变量 char last = str.charAt(0);//用于获取下一个单个字符 int length = str.length();//获取字符串长度,用于遍历的条件 int count = 1;//计数器,用于记录每个字符重叠的次数 for(int i = 1 ; i<length ; i++){//从第二个索引开始判断 if(l…
Design and implement a data structure for a compressed string iterator. It should support the following operations: next and hasNext. The given compressed string will be in the form of each letter followed by a positive integer representing the numbe…