I dont know whats wrong in code

There is no compilation error but I think it cant pass certain test cases.However i have tested using given cases and many of my own but still when I submit it shows wrong answer. :frowning: :frowning:
HAVE TRIED A LOT BUT STILL GETTING WRONG ANSWER.

qn Link::------

My Solution::------

https://www.codechef.com/viewsolution/21740757

Try out the test case

monday tuesday 9 9

I think your output will be impossible but output should be 9

ohooo ok got it so its this way also…