有一个函数比较方便,是之前学习截取网站学到的。 public static void main(String[] args) { Scanner sc = new Scanner(System.in); String str = sc.nextLine(); System.out.println(str.length()-str.lastIndexOf(" ")-1); }
13

相关推荐

不愿透露姓名的神秘牛友
昨天 15:45
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客企业服务