Junior — Senior
Minimum distance between characters X and Y
livecode
Task condition
There is a string containing only the characters 'X', 'Y', and 'O'. It is necessary to calculate the minimum number of positions between any pair of 'X' and 'Y' characters. If at least one of these characters is missing in the string, the function should return 0.
def distance(s: str) -> int:
...