n= int(input()) groom= input() brid=input() c_r = brid.count('r') c_m = brid.count('m') lst = [i for i in groom] for i in groom: if i == 'r': if c_r==0: print(len(lst), end='') break c_r-=1 lst.pop(0) elif i == 'm': if c_m==0: print(len(lst),end='') break c_m-=1 lst.pop(0) else: print(0,end='')
Comments
Post a Comment