import java.util.Scanner;

public class Length {
    public static void main(String[] args) {
        while(true){//多行输入
            Scanner scanner = new Scanner(System.in);
            String nexLine = scanner.nextLine();//一行数据,包含空格,末尾的空格也包含了,但是题目中限制末尾无空格

            int num = nexLine.length();
            for (int i = num - 1; i >= 0; i--) {
                if(i==0){
                    System.out.println(num);
                }
                if(nexLine.charAt(i) == ' ') {
                    System.out.println(num - i - 1);
                    break;
                }
            }
        }
    }
}