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; + } +} +