利用substring方法,知道下标 0<=begin<=m-1 1<=end<=n
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String str = in.next(); int m = in.nextInt(); in.close(); //利用subString 来截取,截取长度从m-1 到 n String str_result = str.substring(m-1, n); System.out.println(str_result); } }
0.0分
0 人评分