ltime66 EVENT WHY MY ANS INS WRONG

LINK FOR THE CODE https://www.codechef.com/viewsolution/21694827
PLEASE TELL WHY IS IT GIVING WRONG ANS FOR EVENT QUESTION ASKED IN LUNCHIME

Check out the testcase

monday tuesday 9 9

I think your answer will be impossible but the answer should be 9