def length_of_last_word(s: str):
if not all(ch.isalpha()or ch.isspace()for ch in s):
return:"invalid input"

words=s.strip().split()

if not words:
return"invalid input"

return len(words[-1])

s = input().strip()
print(length_of_last_word(s))