import re

print(max((len(s) for s in re.findall(r"X(?:YZX)*(?:YZ?)?", input())), default=0))