掌握知识点
- StringBuffer类常用方法
- delete()方法
- insert()方法
通关源码
import java.util.Scanner;
public class StrTest {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine();
StringBuffer stringBuffer = new StringBuffer(str);
for (int i = 8; i < 10; i++) {
stringBuffer.insert(29,i).insert(40,i + 10);
System.out.println(stringBuffer);
stringBuffer.delete(29,30).delete(39,41);
}
for (int i = 10; i < 13; i++) {
stringBuffer.insert(29,i).insert(41,i + 10);
System.out.println(stringBuffer);
stringBuffer.delete(29,31).delete(39,41);
}
}
}