题解 | #截取字符串#

截取字符串

http://www.nowcoder.com/practice/a30bbc1a0aca4c27b86dd88868de4a4a

/*
 * 时间: 2021-05-27 21:28
 * 思路: 
 */
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String str = sc.nextLine();
            int len = sc.nextInt();
            sc.nextLine();

            System.out.println(str.substring(0, len));
        }
    }
}
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务