Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- south = str(input())
- north = str(input())
- lst1 = list(south)
- lst2 = list(north)
- counter = 0
- i = 0
- while (len(lst1) != 0 or len(lst2) != 0):
- if len(lst1) == 0 or len(lst2) == 0 or lst1[i] == lst2[i] == 'L':
- lst1 = lst1[1:]
- lst2 = lst2[1:]
- elif (lst1[i] == 'L') & (lst2[i] != 'L'):
- lst2 = lst2[1:]
- elif (lst2[i] == 'L') & (lst1[i] != 'L'):
- lst1 = lst1[1:]
- else:
- lst1 = lst1[1:]
- lst2 = lst2[1:]
- counter += 1
- counter += len(lst1) + len(lst2)
- print(counter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement