简单模拟
#include
#include
#include
#include
#include
using namespace std;#define max_key_len 15
#define max_len 105struct Elem
{char ch;int index;
}letter[max_key_len];char key[max_key_len];
int key_len;
char st[max_len];
int map[max_key_len];bool operator <(const Elem &a, const Elem &b)
{if (a.ch &#61;&#61; b.ch)return a.index < b.index;return a.ch < b.ch;
}void work()
{key_len &#61; strlen(key);for (int i &#61; 0; i
}void output()
{for (int i &#61; 0; i
}int main()
{//freopen("t.txt", "r", stdin);while (gets(key), strcmp(key, "THEEND") !&#61; 0){gets(st);work();sort(letter, letter &#43; key_len);output();}return 0;
}