package 入门5; import java.io.*; import java.util.Scanner; public class P5015标题统计 { public static void main(String []args) { Scanner in = new Scanner(System.in); String str = in.nextLine(); int a = 0; for(int i = 0; i < str.length(); i++) { if(str.charAt(i)==' ') { a++; } } System.out.println(str.length()-a); } }