Advertisement
GalinaKG

07. Hideout

Aug 5th, 2022
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. import re
  2.  
  3. the_map = input()
  4. arrays = input().split()
  5. while arrays:
  6.     searched_character = arrays[0]
  7.     minimum_count = int(arrays[1])
  8.     pattern = fr'\{searched_character}{{{minimum_count},}}'
  9.     result = re.findall(pattern, the_map)
  10.     for match in re.finditer(pattern, the_map):
  11.         start_index = match.start()
  12.         length = match.end() - match.start()
  13.     if result:
  14.         print(f'Hideout found at index {start_index} and it is with size {length}!')
  15.         break
  16.     arrays = input().split()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement