Alice and Bob are traveling to Rome for separate business meetings. You are given 4 strings arriveAlice, leaveAlice, arriveBob, and leaveBob. Alice will be in the city from the dates arriveAlice to leaveAlice (inclusive), while Bob will be in the city from the dates arriveBob to leaveBob (inclusive). Each will be a 5-character string in the format "MM-DD", corresponding to the month and day of the date. Return the total number of days that Alice and Bob are in Rome together. You can assume that all dates occur in the same calendar year, which is not a leap year. Note that the number of days per month can be represented as: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31].
Example 1
Input: arriveAlice = 08-15, leaveAlice = 08-18, arriveBob = 08-16, leaveBob = 08-19
Output: 3
Explanation: Alice is in Rome August 15-18 and Bob August 16-19. They overlap on August 16th, 17th, and 18th, so the answer is 3.
Example 2
Input: arriveAlice = 10-01, leaveAlice = 10-31, arriveBob = 11-01, leaveBob = 12-31
Output: 0
Explanation: Alice leaves on October 31 and Bob arrives on November 1, so there is never a day when both are in Rome.
Example 3
Input: arriveAlice = 01-01, leaveAlice = 12-31, arriveBob = 06-15, leaveBob = 06-20
Output: 6
Explanation: Alice stays the whole year, so Bob's entire June 15-20 trip overlaps with her, giving all 6 of Bob's days.
Turn each date into its day number within the year, then the two stays become two intervals on a number line — their overlap is max(0, min(ends) - max(starts) + 1).
Run checks all cases above. Submit evaluates all test cases.