fork download
  1. def is_subsequence(a, b):
  2. seq = iter(b)
  3. return all(i in seq for i in a)
  4.  
  5. print(is_subsequence('ad', 'abcd'))
  6. print(is_subsequence('adc', 'abcd'))
Success #stdin #stdout 0.02s 9248KB
stdin
Standard input is empty
stdout
True
False