package 字符串最后一个单词的长度;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
while(input.hasNext()){
String s = input.nextLine();
int len = s.length();
int ans = 0;
int i = len -1;
while(true){
if(i>=0){
if(s.charAt(i) == ' '){
i--;
} else {
break;
}
} else {
break;
}
}
for(;i>=0;i--){
if(s.charAt(i) == ' '){
break;
} else {
ans++;
}
}
System.out.println(ans);
}
input.close();
}
}