字母重排

tarp given score refund only trap work earn course pepper part
******

resco nfudre aptr sett oresuc

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <list>
#include <vector>
using namespace std;
#define DEBUG
int f=0;
char c[1000][100],x[1000][10],k[1000][10];
void ff(char s[10])
{
	char ss[10];
	strcpy(ss,s);
	int l=strlen(s);
	for (int i=0; i<l; i++)
		for (int j=i+1; j<l; j++)
		if (s[i] > s[j])
		{
			char t=s[i];
			s[i]=s[j];
			s[j]=t;
		}
	strcpy(k[f++],s);
	strcpy(s,ss);
	//memset(&k[f++],s,sizeof(char));
}
int main()
{
#ifdef DEBUG
	freopen("cin.txt", "r", stdin);
	freopen("cout.txt", "w", stdout);
#endif
	char s[10];
	while (~scanf("%s",x[f]) && x[f][0]!='*')
		ff(x[f]);
	int h=f;
	while (~scanf("%s",s))
	{
		ff(s);
		int fff=0;
		for (int i=0; i<h; i++)
		{
			if (strcmp(k[i],k[f-1])==0)
			{
				printf(" %s",x[i]);
				fff=1;
			}
		}
		if (fff==0) printf(":(");
		printf("\n");
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值