import math # Press the green button in the gutter to run the script. if __name__ == '__main__': input = input() inner = False innercount = 0 totaloppositeneeded = 0 totalneeded = 0 red = 0 blue = 0 result = 0 tiles = [] for char in input: tiles.append(char) if char == 'X': blue +=1 if char == 'O': red +=1 if red > blue: inner = False innercount = math.sqrt(blue) if blue > red: inner = True innercount = math.sqrt(red) totaloppositeneeded = innercount*4 +4 totalneeded = totaloppositeneeded + innercount j = 0 for i in range (len(tiles)): tempred = 0 tempblue = 0 j = i while j < len(tiles): if tiles[j] == 'X': tempblue +=1 if tiles[j] == 'O': tempred += 1 j = j+1 if (inner == False and innercount == tempblue and totaloppositeneeded <= tempred): result +=1 if (inner == True and innercount == tempred and totaloppositeneeded <= tempblue): result +=1 print(result)