MariyanGrigorov

Untitled

Jun 17th, 2024
820
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | Software | 0 0
  1. import re
  2.  
  3. main_string = input()
  4. patterns = re.compile(
  5.     r"([=/])(?P<location>[A-Z][a-zA-Z]{2,})\1")
  6. list_result = list()
  7. result = re.finditer(patterns, main_string)
  8. total_points = 0
  9. for show in result:
  10.     list_result.append(show["location"])
  11.     total_points += len(show["location"])
  12.  
  13. print(f"Destinations: {', '.join(list_result)}")
  14. print(f"Travel Points: {total_points}")
Advertisement
Add Comment
Please, Sign In to add comment