Sanket and string question my code is not giving any putput

https://ide.codingblocks.com/s/119813 can you please correct it

Hello @Anoushka_1805,

There is a problem with your input statements.
Following is the order of inputs:

  1. The first line contains an integer denoting the value of K.
  2. The next line contains a string having only β€˜a’ and β€˜b’ as the characters.

Your program follows a wrong order:

  1. The first line contains a string having only β€˜a’ and β€˜b’ as the characters.
  2. The second line contains an integer denoting the value of K.

Do the necessary modifications and share the modified code if still doesn’t work.

Suggestion:
Always, run your code on sample testcases given in the question before submitting it.

Hope, this would help.
Give a like, if you are satisfied.

@Anoushka_1805 as virender discuss the bug of your program I would like discuss one more thing is that how can you declare a array of size n even you did not take input n in your program .If you print the n it give you zero as output fix that too hope this will help you.