During solving this problem(Problem Link) I first used set for maintaing count of the cases but it was giving wrong ans on test5 but when I used integer for count it passed all test cases and i'm unable to find why using set giving wrong ans.
here are my submissions : 1)using set:286839990 2)using integer:286840330