Problem in question

question-https://codeforces.com/contest/1400/problem/A
ans-https://ide.codingblocks.com/s/321245

please tell the why i am getting wrong ans, i am very confused

Hey @shivamgoel150
The test case which will not work for your code :
n=4
1000111
so your answer will be 1000 ,which will not match with the last substring(0111)

Here is the tutorial for the same

  • let the answer be s1s3s5…s2n−1s1s3s5…s2n−1, so it coincides with s[1…n]s[1…n] in the first character, with s[2…n+1]s[2…n+1] in the second character, and so on;
  • copy the character snsn nn times, since it appears in every substring we are interested in;
  • find the character that occurs at least nn times in ss, and build the answer by copying it nn times;
  • and many others.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.