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