From 9e5ba6ce704a2cb61449da29aeb3e9e6d801d67f Mon Sep 17 00:00:00 2001 From: Sandeep Pal Date: Mon, 28 Aug 2023 09:14:58 +0530 Subject: [PATCH] Create 058_Length_of_Last_Word.py --- 058_Length_of_Last_Word.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 058_Length_of_Last_Word.py diff --git a/058_Length_of_Last_Word.py b/058_Length_of_Last_Word.py new file mode 100644 index 0000000..e323602 --- /dev/null +++ b/058_Length_of_Last_Word.py @@ -0,0 +1,3 @@ +class Solution: + def lengthOfLastWord(self, s: str) -> int: + return len(s.strip().split(' ')[-1])