题目描述:
从X星截获一份电码,是一些数字,如下:
 13
 1113
 3113
 132113
 1113122113
 ....
 YY博士经彻夜研究,发现了规律:
 第一行的数字随便是什么,以后每一行都是对上一行“读出来”
 比如第2行,是对第1行的描述,意思是:1个1,1个3,所以是:1113
 第3行,意思是:3个1,1个3,所以是:3113
 请你编写一个程序,可以从初始数字开始,连续进行这样的变换。
代码:
package lanqiao;
import java.math.BigInteger;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        int n = sc.nextInt();
        for(int i = 0;i < n;i ++)
        {
            char[] temp = s.toCharArray();
            int tempcount = 1;
            s = "";
            for(int j = 0;j <temp.length - 1;j ++)
            {
                if(temp[j] == temp[j + 1])
                {
                    tempcount += 1;
                }
                else{
                    s += tempcount+""+temp[j];
                    tempcount = 1;
                }
            }
            s += tempcount+""+temp[temp.length - 1];
            if(i == n - 1)
            {
                System.out.println(s);
                break;
            }
        }
    }
}









