Advertisement
frolkin28

ht1.py

Oct 23rd, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. n = 7
  2. a = [-10, 0, 1, 2, 3, 4, 5]
  3. m = 6
  4. b = [11, 0, 1, 2, 3, 11]
  5. l = 5
  6. c = [100, 0, 1, 2, 3]
  7.  
  8.  
  9. for i in range(n):
  10.     if a[i] in b and a[i] in c:
  11.         res = a[i]
  12.         break
  13.  
  14. try:
  15.     i = a.index(res)
  16.     j = b.index(res)
  17.     k = c.index(res)
  18.  
  19.     length = 1
  20.     index = 2
  21.  
  22.     while True:
  23.         if a[i:i + index] == b[j:j + index] == c[k:k + index]:
  24.             length += 1
  25.             index += 1
  26.         else:
  27.             break
  28.  
  29.     print(length)
  30. except:
  31.     print('Sequences have no subsequences')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement