FACING RUNTIME ERROR
Here is my code:
include <bits/stdc++.h>
using namespace std;
void Tswap(string s, int p , map<string , int> &m){
char temp=s[p];
s[p]=s[p+1];
s[p+1]=s[p+2];
s[p+2]=temp;
m[s]=1;
}
int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int n;
cin>>n;
string s;
cin>>s;
map<string , int> m;
for(int i=0;i<n-2;i++){
Tswap(s,i,m);
}
cout<<m.size()<<endl;
}
return 0;
}
Problem link :Triangular Swaps Practice Coding Problem - CodeChef