My code is passing test cases but giving wrong answer on submission

Problem : Contest Page | CodeChef
My code :

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;




int main(){
    int t;
    cin>>t;
    vector <string> input;
    for(int i=0;i<t;i++)
    {
        int h;cin>>h;
         string k;cin>>k;
        input.push_back(k);
    }

    for(int i=0;i<input.size();i++)
    {
       int sum=1;
       for(int j=0;j<input[i].size()-1;j++)
       {
          if(input[i][j]!=input[i][j+1])
          {
              sum=sum+1;
          }
       }
     if(sum%2==0)
     {

         input[i]="RAMADHIR";
     }
     else if(sum%2!=0)
     {
         input[i]="SAHID";
     }



    }
    for(int i=0;i<input.size();i++)
    {
        cout<<input[i]<<endl;
    }




}