d = input() + input() # print(d) for i in reversed(range(15)): s = '' for j in range(i): s += 'o' # print(i, s) if s in d: print(i); break