diff --git a/csharp/58-Length-of-Last-Word.cs b/csharp/58-Length-of-Last-Word.cs new file mode 100644 index 000000000..2db7808e3 --- /dev/null +++ b/csharp/58-Length-of-Last-Word.cs @@ -0,0 +1,8 @@ +public class Solution { + public int LengthOfLastWord(string s) { + s = s.TrimEnd(); + string[] arr = s.Split(' '); + return arr[arr.Length - 1].Length; + } +} +
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: