#abc301c. C - AtCoder Cards

C - AtCoder Cards

Score : 300300 points

问题描述

在 AtCoder Inc. 中流行一款单人纸牌游戏。游戏中每张卡片上都写有一个小写字母或符号 @。每种类型的卡片都有大量供应。游戏流程如下:

  1. 在两行中排列相同数量的卡片。
  2. 将所有带有 @ 符号的卡片替换为以下任意一张卡片:a, t, c, o, d, e, r
  3. 若两行卡片完全相同,则你获胜;否则,你失败。

为了赢得这场比赛,你将采取以下作弊策略:

  • 在步骤 1 完成后,只要你愿意,可以随时自由重新排列一行中的卡片。

给定两个字符串 SSTT,分别代表你在步骤 1 后得到的两行卡片。确定在允许作弊的情况下是否有可能获胜。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

A single-player card game is popular in AtCoder Inc. Each card in the game has a lowercase English letter or the symbol @ written on it. There is plenty number of cards for each kind. The game goes as follows.

  1. Arrange the same number of cards in two rows.
  2. Replace each card with @ with one of the following cards: a, t, c, o, d, e, r.
  3. If the two rows of cards coincide, you win. Otherwise, you lose.

To win this game, you will do the following cheat.

  • Freely rearrange the cards within a row whenever you want after step 1.

You are given two strings SS and TT, representing the two rows you have after step 1. Determine whether it is possible to win with cheating allowed.

Constraints

  • SS and TT consist of lowercase English letters and @.
  • The lengths of SS and TT are equal and between 11 and 2×1052\times 10^5, inclusive.

Input

The input is given from Standard Input in the following format:

SS

TT

Output

If it is possible to win with cheating allowed, print Yes; otherwise, print No.

Sample Input 1

ch@ku@ai
choku@@i

Sample Output 1

Yes

You can replace the @s so that both rows become chokudai.

Sample Input 2

ch@kud@i
akidu@ho

Sample Output 2

Yes

You can cheat and replace the @s so that both rows become chokudai.

Sample Input 3

aoki
@ok@

Sample Output 3

No

You cannot win even with cheating.

Sample Input 4

aa
bb

Sample Output 4

No

update @ 2024/3/10 08:26:58