import java.util.Scanner; public class Main{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input = scan.nextLine(); if (input.length() > 5000) { System.out.println("长度超过5000!"); return; } // 索引从0开始,所以要加1,并且避免无空格情况 int lastSpaceIndex = input.trim().lastIndexOf(" ")+1; System.out.println(input.trim().length() - lastSpaceIndex); } }