anony12345 (you do realize that you're not fully anonymous here, right?), a good way of getting help in ANY walk of life is to show that you're struggling before asking for help. To struggle, you need to actually try to do something.
If you post code that you've written so far and it's anything more than a bare skeleton, that'll be more likely to get you help.
That said, this is a codechef problem, and I'm pretty sure it's against the spirit (and/or rules) of that site to get help from other people to boost your rank, so... good luck!
> But I cannot figure out how to impose the first condition
say that you are somewhere on the middle, in an even position, so may chose between [a-z], which we may break into two groups: the ones that are in K and the ones that aren't
considering the one to your right you'll have {K-1} * {K-1} + {[a-z]-K} * K options, and the same may be said about the pair that you have to the right.
missing requirement?
if K >2, or 3 (not 100% sure) the answer is infinity. You have a finite expected answer, so the problem is not completely stated. This is tied to N … is N always 5, or user input, or ?? Where did it come from, it appears like magic in the test cases without mention in the problem.
is K a-z or anything in Unicode? If K were made up of stuff not in a-z it matters.