赞
踩
- 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);
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。