with open("text.txt", "r") as file:
s = file.readline()
k = 0
kmax = 0
for i in range(1, len(s)-3):
if s[i:i+3] == 'XYZ':
k = k + 1
i+=2
if k > kmax :
kmax = k
else:
k = 0
print(kmax)