s = input()
words_count = 0
letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
separators = [' ', ',', '.', '!', '?']
in_word = False
for ch in s:
if ch in letters:
if not in_word:
words_count += 1
in_word = True
if ch in separators:
in_word = False
print(words_count)