Advertisement
Guest User

Exercise 06 B

a guest
Jun 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import sys
  4.  
  5. # Functions
  6.  
  7. def is_subsequence(s, t):
  8. ''' Return whether or not s is a subsequence of t '''
  9. index = 0
  10. for letter in t:
  11. if s[index] == letter:
  12. index += 1
  13. if index == len(s):
  14. return True
  15.  
  16. return False
  17.  
  18. # Main Execution
  19.  
  20. if __name__ == '__main__':
  21. for line in sys.stdin:
  22. s, t = map(list, line.split())
  23. print(is_subsequence(s, t))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement