Regarding MAXEXP editorial

why this is giving WA it was correct for test cases??? can anyone explain

you can also see that if u sort the string ‘+’ comes first then ‘-’ comes, then the numbers in ascending order.
next i counted how many symbols are there either 1 or 2 ; if 1 then either (+ or -) then print the numbers from n-1 to 2 and then print character s[0] (+ or -) then the smallest number s[1] as already sorted;

for count = 2 , I printed the number from n-1 to 4 , then printed (+) character then 2nd smallest number(s[3]), then (-) character, then then the smallest number

void solve(){

ll n; cin>>n;

string s; cin>>s;

sort(s.begin(),s.end());

ll count = 0;

for(ll i=0; i<=1; i++){

    if(s[i]=='+') count++;

    else if(s[i]=='-') count++;

}

if(count == 1){

    for(ll i=n-1; i>=2; i--) cout<<s[i];

    cout<<s[0]<<s[1];

    cout<<endl;

}

else if(count == 2){

    for(ll i=n-1; i>=4; i--) cout<<s[i];

    cout<<s[0]<<s[3]<<s[1]<<s[2];

    cout<<endl;

}

}

Hey @neel_04 - your code is failing here. Hope this helps.

1
42
7-0+48+2+5+17-1+276+4-32-16+576-892+954+12

there can be more + and - negative digits… didn’t see that thanks :sweat: