#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n,i,j,k,l,m,sum,sum1,sum2,sum3,sum4,sum5,flag;
char v,w,x,y,z;
char dest[30],turn[30];
while(1)
{
flag=0;
cin >> n >>dest;
int xx=strlen(dest);
if(n==0&&xx==3&&dest[0]=='E'&&dest[1]=='N'&&dest[2]=='D')
break;
sort(dest,dest+xx);//读题,字典序......
阅读全文