利用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 人评分
字符串对比 (C语言代码)浏览:1471 |
A+B for Input-Output Practice (IV) (C语言代码)浏览:513 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:537 |
The 3n + 1 problem (C语言代码)浏览:550 |
简单的a+b (C语言代码)浏览:491 |
上车人数 (C语言代码)浏览:752 |
老王赛马 (C++代码)浏览:973 |
P1001 (Java代码)浏览:740 |
test 2浏览:715 |
WU-玉龙学长买雪糕 (C++代码)浏览:1154 |