import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param s string字符串 
     * @return int整型
     */
    public int lengthOfLastWord (String s) {
        // write code here
        String[] arr = s.split(" ");
        for(int i = arr.length - 1;i >= 0;i--){
            if(arr[i] != " "){
                return arr[i].length();
            }
        }
        return 0;
    }
}