Hello,

I am working on this problem on Kattis. I have been constantly thinking about it for the last 3 hours, but it seems that I am totally hopeless on this problem. Can someone give me some hints?

(I know 3 hours is too short :(. Normally I would only give up if it lasted for a few days, but I am in my urgent self-training period before an NWERC, so I change my plan to solve problems that I am totally hopeless instead of those that are hard but still somehow solvable and I use all this time just to make sure that it is really impossible for me)

Thank you. Happy Coding

The answer is sum of the three sub-problems:

`?`

`?`

, no of inversions created against known charactersTo give you an example:

`01?01?`

`0101`

: 1 inversion x 2^k -> 4`??`

->`00`

,`01`

,`10`

,`11`

-> 1`?`

(consider both 0 and 1 cases) + Number of inversions created by the second`?`

.Thank you I have completed it and also understood it completely :)) You are a big help

hi, I have some detailed question about problem.

seperately within the whole string?

I'm probably just doing something wrong but could you explain how this would work with ?0?

Can you describe it in more easy way.I can't understand it. THANKS