public int lengthOfLastWord(String s) {
        if(s==null)
            return 0;
        int count = 0;
        for(int i=s.length()-1;i>=0;i--)
        {
            if(s.charAt(i)!=' ')
            {
                count ++;
                continue;
            }
            if(count == 0)
                continue;
            break;
        }
        return count;
    }