Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. south = str(input())
  2. north = str(input())
  3. lst1 = list(south)
  4. lst2 = list(north)
  5. counter = 0
  6. i = 0
  7.  
  8. while (len(lst1) != 0 or len(lst2) != 0):
  9.     if len(lst1) == 0 or len(lst2) == 0 or lst1[i] == lst2[i] == 'L':
  10.         lst1 = lst1[1:]
  11.         lst2 = lst2[1:]
  12.     elif (lst1[i] == 'L') & (lst2[i] != 'L'):
  13.         lst2 = lst2[1:]
  14.     elif (lst2[i] == 'L') & (lst1[i] != 'L'):
  15.         lst1 = lst1[1:]
  16.     else:
  17.         lst1 = lst1[1:]
  18.         lst2 = lst2[1:]
  19.     counter += 1
  20. counter += len(lst1) + len(lst2)
  21. print(counter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement