差两个点,怎么调都不对了,求调……
#include <bits/stdc++.h>
using namespace std;
int n, sc, tc, bs[30], bt[30];
string s, t;
bool check(char ch)
{
switch(ch)
{
case 'a': case 't': case 'c': case 'o': case 'd': case 'e': case 'r':
return 1;
default: return 0;
}
}
int main()
{
cin >> s >> t, n = s.size(), s = ' '+s, t = ' '+t;
if(s.size() != t.size()) {printf("No"); return 0;}
for(int i = 1; i <= n; i++)
if(s[i] != '@') bs[s[i]-'a']++;
else sc++;
for(int i = 1; i <= n; i++)
if(t[i] != '@') bt[t[i]-'a']++;
else tc++;
for(int i = 0; i < 25; i++)
if(bs[i] > bt[i])
if(!check(char(i+'a'))) {printf("No"); return 0;}
else
{
tc -= bs[i];
if(tc < 0) {printf("No"); return 0;}
}
for(int i = 0; i < 25; i++)
if(bt[i] > bs[i])
if(!check(char(i+'a'))) {printf("No"); return 0;}
else
{
sc -= bt[i];
if(sc < 0) {printf("No"); return 0;}
}
printf("Yes");
return 0;
}