package com.thinker.bishi.huawei;

import java.util.Scanner;

public class CountLastWordLength{

	public static int count(String str){
		if(null == str || "".equals(str)) return 0;
		int count = 0;
		for(int i=str.length()-1;i>=0;i--){
			if(str.charAt(i) != ' ')count += 1;
			else break;
		}
		return count;
	}

	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		String inStr = in.nextLine();
		System.out.println(count(inStr));
	}
}
