# Given a string consisting of the letters 'X', 'Y', and 'O'. # Find the shortest distance between the letters 'X' and 'Y', # or output 0 if 'X' or 'Y' are missing. # "YY" -> 0 # "XX" -> 0 # "XY" -> 1 # "YOX" -> 2 # "OOOXOOYOXO" -> 2 # "OOOXXOY" -> 2 def distance(string: str) -> int:
Intern
200