看看这个行吗?
- public class Main {
-
- public static void main(String[] args) {
- String o = "abcdefghijklmnopqrs";
- String s = "";
- for (int i = 0; i < 106; i++) {
- s += o;
- }
-
- while (s.length() > 1) {
- if (s.length() % 2 != 0)
- s = s.substring(0, s.length() - 1);
- s = s.replaceAll("[a-z]([a-z])", "$1");
- }
-
- System.out.println(s);
- }
-
- }
复制代码 |