58. Length of Last Word
Input: s = "Hello World"
Output: 5Input: s = " "
Output: 0public class Solution {
public int LengthOfLastWord(string s) {
return s.Trim().Split(' ').Last().Length;
}
}Last updated
Input: s = "Hello World"
Output: 5Input: s = " "
Output: 0public class Solution {
public int LengthOfLastWord(string s) {
return s.Trim().Split(' ').Last().Length;
}
}Last updated