Advertisement
Guest User

Untitled

a guest
Mar 20th, 2022
565
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import re
  2.  
  3. pattern = r"(=|/)([A-Z][A-Za-z]{2,})\1"
  4. places = input()
  5. valid_destinations = []
  6. len_of_destinations = 0
  7. destinations = ''
  8. for destination in re.finditer(pattern, places):
  9.     valid_destinations.append(destination.group(2))
  10.  
  11. for valid in valid_destinations:
  12.     len_of_destinations += len(valid)
  13. to_print = ', '.join(valid_destinations)
  14. print(f"Destinations: {to_print}")
  15. print(f"Travel Points: {len_of_destinations}")
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement