Scanner sc = new Scanner(System.in); //System.out.print("请输入字符串:"); str = sc.nextLine(); char[] chs = str.toCharArray();