import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String s = br.readLine();
int n = Integer.parseInt(br.readLine());
while(n-->0){
char c[] = s.toCharArray();
StringBuilder sb = new StringBuilder();
char t = c[0];
int count = 0;
for (int i = 0; i < c.length; i++) {
if(c[i] == t){
count++;
}else{
t = c[i];
sb.append(count+""+(c[i-1]-48));
count=1;
}
}
sb.append(count+""+(c[c.length-1]-48));
s = sb.toString();
}
System.out.println(s);
}
}
蓝桥杯 第六届决赛 奇怪的数列 JAVA
最新推荐文章于 2022-06-17 20:09:28 发布