My solution gives me the correct answer 1 when I run it locally on my machine but the OJ gives 0, so I am confused.

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