文章
11
粉丝
414
获赞
9
访问
109.1k
#include <iostream>
#include <cstring>
using namespace std;
void bubble(char s1[]);
int main()
{
int n;
cin >> n;
char s1[100], s2[100];
while(n--)
{
cin >> s1 >> s2;
int len1 = strlen(s1);
int len2 = strlen(s2);
int flag_bw = 0; //变为词标记,0否 1是
bubble(s1);
bubble(s2);
if(len1 == len2) //两单词字母数相等时才比较字母是否相等
{
for(int i = 0; i < len1; ++i)
{
if(s1[i] == s2[i])
flag_bw = 1;
else
{
flag_bw = 0;
break;
}
}
}
else
cout << "No" << endl;
if(flag_bw == 1)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}
//字母排序按ascii
void bubble(char s[])
{
int temp, flag = 0;
for(int i = 0; i < strlen(s) - 1; ++i)
{
for(int j = 0; j < strlen(s) - i - 1; ++ j)
{
if(int(s[j]) > int(s[j + 1]))
{
temp = s[j];
s[j] = s[j + 1];
s[j + 1] = temp;
...
登录后发布评论
暂无评论,来抢沙发