

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
英小文字のみからなる文字列 , が与えられます。
文字列 に対して、次の操作を何度でも行うことができます。
操作: 2つの異なる英小文字 , を選び、 に含まれる全ての を に、 を に置き換える
回以上操作を行って、 を に一致させられるか判定してください。
制約
- , は英小文字のみからなる
入力
入力は以下の形式で標準入力から与えられる。
出力
を に一致させられる場合は Yes
、そうでない場合は No
を出力せよ。
入力例 1Copy
azzel apple
出力例 1Copy
Yes
次のように操作を行えば、azzel
を apple
にできます。
- として
e
を、 としてl
を選ぶと、azzel
がazzle
になる - として
z
を、 としてp
を選ぶと、azzle
がapple
になる
入力例 2Copy
chokudai redcoder
出力例 2Copy
No
どのように操作を行っても chokudai
を redcoder
にできません。
入力例 3Copy
abcdefghijklmnopqrstuvwxyz ibyhqfrekavclxjstdwgpzmonu
出力例 3Copy
Yes
Score : points
Problem Statement
You are given strings and consisting of lowercase English letters.
You can perform the following operation on any number of times:
Operation: Choose two distinct lowercase English letters and , then replace every occurrence of with , and every occurrence of with .
Determine if and can be made equal by performing the operation zero or more times.
Constraints
- and consists of lowercase English letters.
Input
Input is given from Standard Input in the following format:
Output
If and can be made equal, print Yes
; otherwise, print No
.
Sample Input 1Copy
azzel apple
Sample Output 1Copy
Yes
azzel
can be changed to apple
, as follows:
- Choose
e
as andl
as .azzel
becomesazzle
. - Choose
z
as andp
as .azzle
becomesapple
.
Sample Input 2Copy
chokudai redcoder
Sample Output 2Copy
No
No sequences of operation can change chokudai
to redcoder
.
Sample Input 3Copy
abcdefghijklmnopqrstuvwxyz ibyhqfrekavclxjstdwgpzmonu
Sample Output 3Copy
Yes