SimeonTs

SUPyF2 Text-Processing-Lab - 03. Substring

Oct 26th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. """
  2. Text Processing - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1739#2
  4.  
  5. SUPyF2 Text-Processing-Lab - 03. Substring
  6.  
  7. Problem:
  8. On the first line you will receive a string. On the second line you will receive a second string.
  9. Write a program that removes all of the occurrences of the first string in the second until there is no match.
  10. At the end print the remaining string.
  11.  
  12. Example:
  13. Input:  Output:
  14. ice     kicegiciceeb
  15.  
  16. Comment:
  17. kgb We remove ice once and we get "kgiciceeb"
  18. We match "ice" one more time and we get "kgiceb"
  19. There is one more match. The finam result is "kgb"
  20. """
  21. to_remove = input()
  22. string = input()
  23.  
  24. while to_remove in string:
  25.     string = string.replace(to_remove, '')
  26. print(string)
Add Comment
Please, Sign In to add comment