给定明文和可能的密文,确定是否可以使用上述方案从明文形成密文

Given a plain text and a possible cipher text, determine whether the cipher text can be formed from the plain text using the mentioned scheme

字母表被枚举为 A = 0, B = 1, C = 2, ... , Z = 25。考虑一个加密方案,其中明文中值为 Ci 的字符被替换为另一个值为 Cj 的字符使用公式 Cj = (Ci + 5) % 26。替换后,将生成的字符串随机打乱(排列)以获得密文。

给定一个明文和一个可能的密文,你的任务是确定是否可以使用上述方案从明文形成密文。

(假设所有字符串都是大写)

输入格式:

输入的第一行包含一个表示纯文本的字符串。

第二行输入一个字符串表示可能的密文

输出格式:

显示Yes或No(输出后无换行符)

示例:

输入:

PYTHON TDMSUY

输出:

输入:

JOCPNPTEL JQYVSUTHO

输出:

没有

请在Python

中回答

IPYNB Formatted Code Here

s = input()
p = input()
#s = s[::-1]
t = ''
for c in s:
  t+=chr((ord(c)+5-ord('A'))%26 + ord('A'))
  

def removeSpaces(string): 
    string = string.replace(' ','') 
    string = string.replace(',','')
    return string.lower()
def check(t, p):
     
    # the sorted strings are checked 
    if(sorted(t)== sorted(p)):
        print("Yes",end='') 
    else:
        print("No",end='')         
         
check(t, p)

谢谢你们,这就是我想出的

`x=input()
y=input()
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
t=''
for i in x:
  c=a.index(i)
  cj=(c+5)%26
  t=t+a[cj]
if(sorted(y)==sorted(t)):
  print("Yes",end='')
else:
  print("No",end='')`
a=input()
d={}
for i in a:
  d[chr(((ord(i)-60)%26)+65)]=d.get(chr(((ord(i)-60)%26)+65),0)+1
b=input()
for i in b:
  if d.get(i,0)<=0:
    print("No",end="")
    break
  d[i]-=1
else:
  print("Yes",end="")