One test case not passing displaying wrong answer
@G_rahil
you need to do
if(i==n){
cout<<s[i];
}
since a[i] == a[n] could be true for same characters.
@G_rahil
you need to do
if(i==n){
cout<<s[i];
}
since a[i] == a[n] could be true for same characters.