My issue
in the 4th test case , why we delete r instead of s .
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
int ma=INT_MIN;
for(int i=0;i<n;i++){
int x=s[i];
ma=max(ma,x);
}
for(int i=0;i<n;i++){
int y=s[i];
if(y==ma){
for(int j=0;j<n;j++){
if(j!=i)
{
cout<<s[j];
}
}cout<<endl;
break;
}
}
}
}
Problem Link: Spell Shortening Practice Coding Problem