a=input()
b=input()
c=0
d=[]
for i in range(1,7):
    if a[i]==a[i-1]=="o":
        c+=1
    else:
        d.append(c)
        c=0
    if i==6:
        for j in range(6):
            if (a[i]=="o") and (b[j]=="o") and (j==0):
                c+=1
            elif b[j]==b[j-1]=="o":
                c+=1
            else:
                d.append(c)
                c=0  
                
                
        
d.append(c)
if max(d)==0:
    print(0)
else:
    print(max(d)+1)