T了贼多发,然后发现改为scanf就能过了,哈哈!
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define fi first
#define se second
#define mem(a,x) memset(a,x,sizeof(a));
#define db double
#define fir(i,a,n) for(int i=a;i<=n;i++)
//======================
const int N=1e6+10;
char a[N];
int main()
{
int t;scanf("%d",&t);
while(t--)
{
int n;scanf("%d",&n);
scanf("%s",a);
string ans;
int len=strlen(a);
if(a[len-1]>a[len-2]) ans+="<";
else ans+=">";
for(int i=len-2;i>=1;i--)
{
if(a[i]<a[i-1]) ans+=">";
else if(a[i]>a[i-1]) ans+="<";
else
{
ans+=ans[ans.size()-1];
}
}
for(int i=ans.size()-1;i>=0;i--)
{
printf("%c",ans[i]);
}
cout<<endl;
}
return 0;
}