exercicio 58 resolvido com python
This commit is contained in:
10
58-length_of_last_word/python/58.py
Normal file
10
58-length_of_last_word/python/58.py
Normal file
@ -0,0 +1,10 @@
|
||||
# 58. Length of Last Word
|
||||
#
|
||||
# Given a string s consisting of words and spaces, return the length of the
|
||||
# last word in the string.
|
||||
#
|
||||
# A word is a maximal substring consisting of non-space characters only.
|
||||
|
||||
|
||||
def lengthOfLastWord(s: str) -> int:
|
||||
return len(s.strip().split(" ")[-1])
|
||||
Reference in New Issue
Block a user