Problem:


シーザー暗号

問題

ガイウス・ユリウス・カエサル（Gaius Julius Caesar)，英語読みでジュリアス・シーザー（Julius Caesar）は，古代ローマの軍人であり政治家である．カエサルは，秘密の手紙を書くときに， 'A' を 'D' に， 'B' を 'E' に， 'C' を 'F' に，というように3つずらして表記したという記録が残っている．

大文字のアルファベット26文字だけからなる文字列を，カエサルがしたように3文字ずつずらす変換を施し得られた文字列がある．このような文字列を元の文字列に戻すプログラムを作成せよ．

各文字の変換前と変換後の対応は次のようになる．

  変換前
  A
  B
  C
  D
  E
  F
  G
  H
  I
  J
  K
  L
  M
  N
  O
  P
  Q
  R
  S
  T
  U
  V
  W
  X
  Y
  Z
  

  

  変換後
  D
  E
  F
  G
  H
  I
  J
  K
  L
  M
  N
  O
  P
  Q
  R
  S
  T
  U
  V
  W
  X
  Y
  Z
  A
  B
  C 
  

例えば，この方法で文字列 JOI を変換すると MRL が得られ，この方法で変換された文字列 FURDWLD の元の文字列は CROATIA である． 

入力

入力は1行だけからなり，その1行は大文字のアルファベットのみで構成される文字列を1つ含む．

入力される文字列の長さは 1000 以下である． 

出力

入力された文字列を元に戻した文字列だけを含む1行を出力する。

入出力例

入力例 1

MRL

出力例 1

JOI

入力例 2

FURDWLD

出力例 2

CROATIA

上記問題文と自動審判に使われるデータは、情報オリンピック日本委員会が作成し公開している問題文と採点用テストデータです。



Sample input:
MRL


Sample output:
JOI

Submission status: Wrong Answer

Solution code:
x = input()

str_list = list(x)

for a in str_list:
    if ord(a) + 3  > 90:
        print(chr(ord(a) - 24) ,end = "")
    else:
        print(chr(ord(a) + 3) ,end = "")
print()

Submission status: Wrong Answer

Solution code:
x = input()

str_list = list(x)
dict_ = {

    }

for a in str_list:
    if ord(a) - 3 < 65:
        #print(90 + (ord(a)) - (ord(a)) )
        print(chr(90 + (ord(a)) - (ord(a))) ,end = "")
    else:
        print(chr(ord(a) - 3) ,end = "")
print()

Submission status: Wrong Answer

Solution code:
import string
uppercase = string.uppercase
caesar = uppercase[3:] + uppercase[:3]
print raw_input().translate(string.maketrans(uppercase,caesar))

Submission status: Wrong Answer

Solution code:
code = raw_input()

encode = ""
for i in xrange(len(code)):
	encode += chr(ord(code[i:i+1]) - 3)

print encode,

Submission status: Wrong Answer

Solution code:
import sys

code = raw_input()

encode = ""
for i in xrange(len(code)):
	encode += chr(ord(code[i:i+1]) - 3)

sys.stdout.write(encode)

Submission status: Wrong Answer

Solution code:
import sys
while True:
	try:
		code = raw_input()
	except EOFError:
		break
	encode = ""
	for i in xrange(len(code)):
		encode += chr(ord(code[i:i+1]) - 3)

	sys.stdout.write(encode)

Submission status: Wrong Answer

Solution code:
code = raw_input()

encode = ""
for i in xrange(len(code)):
	encode += chr(ord(code[i:i+1]) - 3)

print encode

Submission status: Wrong Answer

Solution code:
code = raw_input()

encode = ""
for i in xrange(len(code)):
	if ord(code[i:i+1]) < 65:
		encode += chr(90 - ord(code[i:i+1]))
	else:
		encode += chr(ord(code[i:i+1]) - 3)
		
print encode

Submission status: Wrong Answer

Solution code:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
b = list("DEFGHIJKLMNOPQRSTUVWXYZABC")

x = list(input())
for i in range(len(x)):
    for j in range(len(a)):
        if x[i] == b[j]:
            x[i] = a[j]
            continue
for i in range(len(x)):
    print(x[i], end = "")
print("")

Submission status: Wrong Answer

Solution code:
def decrypt(c):
    if c == 'X':
        return 'A'
    elif c == 'Y':
        return 'B'
    elif c == 'Z':
        return 'C'
    else:
        return chr(ord(c) - 3)


if __name__ == '__main__':
    # ??????????????\???
    # encrypted_txt = 'FURDWLD'
    encrypted_txt = input()

    # ??????????????????
    result = map(decrypt, encrypted_txt)

    # ???????????¨???
    print('{0}'.format(''.join(result)))

Submission status: Wrong Answer

Solution code:
print("".join([chr((ord(i)-38)%26+61)for i in input()]))

Submission status: Wrong Answer

Solution code:
print "".join([chr((ord(i)-38)%26+61)for i in raw_input()])

Submission status: Wrong Answer

Solution code:
ch = input()
for i in range(len(ch)):
    num = ord(ch[i])
    if num<=90:
        num -= 3
    else:
        num += 23
    ans=chr(num)
    print(ans, end='')

Submission status: Wrong Answer

Solution code:
l = input()

for i in l:
    print(chr(ord(i) + 3),end='')

Submission status: Wrong Answer

Solution code:
l = input()

for i in l:
    print(chr(ord(i) - 3),end='')

Submission status: Wrong Answer

Solution code:
import sys
R = lambda:map(int,raw_input().split())
s = raw_input()
ss = []
for i in xrange(len(s)):
    if (ord(s[i]) < ord('X')):
        ss.append(chr(ord(s[i])-3))
    else:
        ss.append(chr(ord(s[i])+23))
print "".join(ss)

Submission status: Wrong Answer

Solution code:
print ''.join( [chr( ord(x)-3 ) for x in list( raw_input() )] )

Submission status: Wrong Answer

Solution code:
text = raw_input()
pr = ''
for i in text:
    
    if ord(i) + 3  > ord('Z'):
        i = chr(ord(i) - ord('Z') + ord('A') - 1)

    pr += chr(ord(i) + 3)

print(pr)

Submission status: Accepted

Solution code:
x = input()

str_list = list(x)
dict_ = {
    "D":"A",
"E":"B",
"F":"C",
"G":"D",
"H":"E",
"I":"F",
"J":"G",
"K":"H",
"L":"I",
"M":"J",
"N":"K",
"O":"L",
"P":"M",
"Q":"N",
"R":"O",
"S":"P",
"T":"Q",
"U":"R",
"V":"S",
"W":"T",
"X":"U",
"Y":"V",
"Z":"W",
"A":"X",
"B":"Y",
"C":"Z"
    }

for a in str_list:
    print(dict_.get(a) , end = "")
print()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

s = input()
ret = ''

for i in range(len(s)):
    ret += chr((ord(s[i]) - ord('A') - 3) % 26 + ord('A'))

print(ret)

Submission status: Accepted

Solution code:
import string
uppercase = string.uppercase
caesar = uppercase[3:] + uppercase[:3]
print raw_input().translate(string.maketrans(caesar,uppercase))

Submission status: Accepted

Solution code:
t = map(chr, xrange(0,256))
for i in range(ord("A"),ord("A")+26):
    t[i] = chr((i-ord("A")+23)%26+ord("A"))
s = raw_input()
ns = s.translate("".join(t))
print ns

Submission status: Accepted

Solution code:
encode = {
	'D':'A',
	'E':'B',
	'F':'C',
	'G':'D',
	'H':'E',
	'I':'F',
	'J':'G',
	'K':'H',
	'L':'I',
	'M':'J',
	'N':'K',
	'O':'L',
	'P':'M',
	'Q':'N',
	'R':'O',
	'S':'P',
	'T':'Q',
	'U':'R',
	'V':'S',
	'W':'T',
	'X':'U',
	'Y':'V',
	'Z':'W',
	'A':'X',
	'B':'Y',
	'C':'Z'
	}

code = raw_input()
conversion = ""

for var in code:
	conversion += encode[var]
	
print conversion

Submission status: Accepted

Solution code:
import string

encrypted = ''.join(chr((ord(c) - 62) % 26 + 65) for c in string.ascii_uppercase)
print(input().strip().translate(str.maketrans(encrypted, string.ascii_uppercase)))

Submission status: Accepted

Solution code:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
b = list("DEFGHIJKLMNOPQRSTUVWXYZABC")

x = list(input())
for i in range(len(x)):
    for j in range(len(a)):
        if x[i] == b[j]:
            x[i] = a[j]
            break
for i in range(len(x)):
    print(x[i], end = "")
print("")

Submission status: Accepted

Solution code:
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
trans = {before: after for before, after in zip(alp[3:] + alp[:3], alp)}

print("".join(trans[c] for c in input().strip()))

Submission status: Accepted

Solution code:
def decrypt(c):
    if ord(c) <= ord('C'):
        return chr(ord(c) - 3 + 26)
    else:
        return chr(ord(c) - 3)


if __name__ == '__main__':
    # ??????????????\???
    # encrypted_txt = 'FURDWLD'
    encrypted_txt = input()

    # ??????????????????
    result = map(decrypt, encrypted_txt)

    # ???????????¨???
    print('{0}'.format(''.join(result)))

Submission status: Accepted

Solution code:
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for x in input():
    print(a[a.index(x)-3],end='')
print()

Submission status: Accepted

Solution code:
n = input()

ans = ""
for i in n:
    if i == 'A':
        ans += 'X'
    elif i == 'B':
        ans += 'Y'
    elif i == 'C':
        ans += 'Z'
    else:
        ans += chr(ord(i) - 3)

print(ans)

Submission status: Accepted

Solution code:
print("".join([chr((ord(i)-42)%26+65)for i in input()]))

Submission status: Accepted

Solution code:
def pipe(x, funcs):
    for func in funcs:
        x = func(x)
    return x


def fmap(fn):
    return lambda x: map(fn, x)


def rot(s, w, base="A", alphabet=26):
    b = ord(base)
    return pipe(s, [
        fmap(ord),
        fmap(lambda x: x - b),
        fmap(lambda x: (x + alphabet + w) % alphabet),
        fmap(lambda x: x + b),
        fmap(chr),
        "".join,
    ])


def main():
    print(rot(input().strip(), -3))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import string

a_to_z = string.ascii_uppercase

input_string = input()

for s in input_string:
    print(chr(((ord(s) - ord('A') - 3) % 26 + ord('A'))), end='')
print("")

Submission status: Accepted

Solution code:
d=dict(zip([chr(i)for i in range(68,91)]+[chr(i)for i in range(65,68)],[chr(i)for i in range(65,91)]))
while 1:
    try:print(''.join([d.get(t) for t in input()]))
    except:break

Submission status: Accepted

Solution code:
a = input()
line = ""
for i in range(len(a)):
    if i == len(a)-1:
        if a[-1]== "A":
            line += "X"
        elif a[-1] == "B":
            line += "Y"
        elif a[-1]== "C":
            line += "Z"
        else:
            line += str(chr(ord(a[-1])-3))
    
    else:
        if a[i]== "A":
            line += "X"
        elif a[i] == "B":
            line += "Y"
        elif a[i]== "C":
            line += "Z"
        else:
            line += str(chr(ord(a[i])-3))
print(line)

Submission status: Accepted

Solution code:
ch = input()
for i in range(len(ch)):
    num = ord(ch[i])
    if num>=68:
        num -= 3
    else:
        num += 23
    ans = chr(num)
    print(ans, end='')
print()

Submission status: Accepted

Solution code:
def main():
    d = list(input())
    alp = [chr(i) for i in range(65, 65 + 26)]

    for x in range(len(d)):
        idx = alp.index(d[x]) - 3
        if idx < 0:
            idx = 26 + idx
        else:
            pass
        d[x] = alp[idx]

    ans = ""
    for x in d:
        ans += x
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
chrs=[ord(c)-65 for c in input()]
ans=""
for c in chrs:
    a=(c-3)%26
    ans+=chr(a+65)
print(ans)

Submission status: Accepted

Solution code:
S = input()
A = []
for i in range(len(S)):
    A.append( chr ((ord(S[i])-65-3) % 26 + 65))

for i in A:
    print(i,end="")
print("")

Submission status: Accepted

Solution code:
# coding: utf-8

a_to_x = ord('X') - ord('A')

char = raw_input()
ans = ""
for i in range(len(char)):
	if char[i] == 'A' or char[i] == 'B' or char[i] == 'C':
		conv = chr(ord(char[i]) + a_to_x)
	else:
		conv = chr(ord(char[i]) - 3)
	ans += conv
print(ans)

Submission status: Accepted

Solution code:
base = ord("A")
s = input()
ans = ""
for i in s:
  ans = ans + chr((ord(i) - base - 3) % 26 + base)
print(ans)

Submission status: Accepted

Solution code:
z='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(*map(lambda x:z[(z.index(x)-3)%26],input()),sep='')

Submission status: Accepted

Solution code:
z='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(*map(lambda x:z[z.index(x)-3],input()),sep='')

Submission status: Accepted

Solution code:
z='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for x in input():print(z[z.index(x)-3],end='')
print()

Submission status: Accepted

Solution code:
z='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(''.join(z[z.index(x)-3]for x in input()))

Submission status: Accepted

Solution code:
print(''.join(chr((ord(x)-42)%26+65)for x in input()))

Submission status: Accepted

Solution code:
# AOJ 0512: Caesar Cipher
# Python3 2018.6.29 bal4u

t = {}
for i in range(26-3): t[chr(i+3+ord('A'))] = chr(i+ord('A'))
t['A'], t['B'], t['C'] = 'X', 'Y', 'Z'
a = input()
ans = ''
for c in a: ans += t[c]
print(ans)

Submission status: Accepted

Solution code:
import sys
R = lambda:map(int,raw_input().split())
s = raw_input()
ss = []
for i in xrange(len(s)):
    if (ord(s[i]) > ord('C')):
        ss.append(chr(ord(s[i])-3))
    else:
        ss.append(chr(ord(s[i])+23))
print "".join(ss)

Submission status: Accepted

Solution code:
import string
print raw_input().translate(string.maketrans('DEFGHIJKLMNOPQRSTUVWXYZABC',
        'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))

Submission status: Accepted

Solution code:
a=raw_input();s="";b=lambda x,y:chr(ord(x)+y)
for i in a:
    s=s+b(i,23) if i in 'ABC' else s+b(i,-3)
print s

Submission status: Accepted

Solution code:
s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
dt = dict([(i,j) for i,j in zip(s[3:] + s[:3],s)])
print "".join([dt[i] for i in raw_input()])

Submission status: Accepted

Solution code:
d={'A': 'X', 'C': 'Z', 'B': 'Y', 'E': 'B', 'D': 'A', 'G': 'D', 'F': 'C', 'I': '\
F', 'H': 'E', 'K': 'H', 'J': 'G', 'M': 'J', 'L': 'I', 'O': 'L', 'N': 'K', 'Q': \
'N', 'P': 'M', 'S': 'P', 'R': 'O', 'U': 'R', 'T': 'Q', 'W': 'T', 'V': 'S', 'Y':\
 'V', 'X': 'U', 'Z': 'W'}
s=raw_input()
t=""
for c in s:
    t+=d[c]
print t

Submission status: Accepted

Solution code:
line = raw_input().strip()
print reduce(lambda a, b:a + b, map(lambda a: chr((ord(a) + 62) % 26 + 65), line))

Submission status: Accepted

Solution code:
import sys

def conv(c):
    if c == 'A':
        return 'X'
    elif c == 'B':
        return 'Y'
    elif c == 'C':
        return 'Z'
    elif c == 'D':
        return 'A'
    elif c == 'E':
        return 'B'
    elif c == 'F':
        return 'C'
    elif c == 'G':
        return 'D'
    elif c == 'H':
        return 'E'
    elif c == 'I':
        return 'F'
    elif c == 'J':
        return 'G'
    elif c == 'K':
        return 'H'
    elif c == 'L':
        return 'I'
    elif c == 'M':
        return 'J'
    elif c == 'N':
        return 'K'
    elif c == 'O':
        return 'L'
    elif c == 'P':
        return 'M'
    elif c == 'Q':
        return 'N'
    elif c == 'R':
        return 'O'
    elif c == 'S':
        return 'P'
    elif c == 'T':
        return 'Q'
    elif c == 'U':
        return 'R'
    elif c == 'V':
        return 'S'
    elif c == 'W':
        return 'T'
    elif c == 'X':
        return 'U'
    elif c == 'Y':
        return 'V'
    elif c == 'Z':
        return 'W'
    return '_err_'
def decode(str):
    strli = list(str)
    ret = []
    for i in strli[:-1]:
        ret.append(conv(i))
    return "".join(ret)

# fp = open("input.txt", "r")
fp = sys.stdin

str = fp.readline()
str = decode(str)
print str

Submission status: Accepted

Solution code:
s = raw_input()
print ''.join([chr((ord(c)-ord('A')+23)%26+ord('A')) for c in s])

Submission status: Accepted

Solution code:
f = lambda x: chr( ord(x)-3 ) if ord(x) >= 68 else chr( ord(x)+23 )
print ''.join( [f(x) for x in list( raw_input() )] )

Submission status: Accepted

Solution code:
print "".join(map(lambda x:chr(((ord(x)-42)%26)+65), raw_input()))

Submission status: Accepted

Solution code:
def rev(c):
	o = ord(c) - 3
	if o < ord('A'):
		return chr(ord('Z') - (ord('A') - o) + 1)
	return chr(o)
print "".join(map(rev, raw_input()))

Submission status: Accepted

Solution code:
text = raw_input()
pr = ''
for i in text:

    if ord(i) - 3  < ord('A'):
        i = chr(ord(i) + ord('Z') - ord('A') + 1)

    pr += chr(ord(i) - 3)

print(pr)

Submission status: Accepted

Solution code:
dic="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
code=raw_input()
ans=""
for w in code:
	ans+=dic[(dic.index(w)+23)%26]
print ans

Submission status: Accepted

Solution code:
a=""
for w in raw_input():
	a+=chr((ord(w)-42)%26+65)
print a

Submission status: Accepted

Solution code:
print "".join([chr((ord(w)-42)%26+65) for w in raw_input()])

Submission status: Accepted

Solution code:
str = raw_input()
out = []
for c in str:
    a = ord(c)
    if a < 68:
        a += 23
    else:
        a -= 3
    out.append(chr(a))
print(''.join(out))

Submission status: Accepted

Solution code:
o=[]
for c in raw_input():
    o.append(chr((ord(c)+10)%26+65))
print ''.join(o)

Submission status: Accepted

Solution code:
t = {}
for i in range(26-3):
    t[chr(i+3+ord("A"))] = chr(i+ord("A"))
t["A"],t["B"],t["C"] = "X","Y","Z"
a = input()
ans = ""
for c in a:
    ans += t[c]
print(ans)

Submission status: Accepted

Solution code:
x="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
y="DEFGHIJKLMNOPQRSTUVWXYZABC"
n=list(input())
for i in range(len(n)):
    for j in range(len(x)):
        if n[i]==y[j]:
            n[i]=x[j]
            print(n[i],end="")
            break
print()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

before=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
after=list("DEFGHIJKLMNOPQRSTUVWXYZABC")

string=input()

ans=""
for s in string:
    ans+=before[after.index(s)]

print(ans)

Submission status: Accepted

Solution code:
import statistics
m = str(input());

A = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
A.extend(A);
l = [];
for i in range(0,len(m)):
    for j in range(0,26):
        if m[i] == A[j]:
            
            
            l.append(A[j-3]);

print(''.join(l));

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
bef = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
aft = "DEFGHIJKLMNOPQRSTUVWXYZABC"

s = list(input())
for i in range(len(s)):
   for j in range(len(aft)):
      if s[i] == aft[j]:
         #print("@", aft[j], bef[j])
         s[i] = bef[j]
         print(s[i], end = "")
         break
print("")

Submission status: Accepted

Solution code:
a = input()
d = str()
for i in range(len(a)):
    b=ord(a[i])-3
    if b<65:
        b=b+26
    c=chr(b)
    d+=c
print(d)

Submission status: Accepted

Solution code:
s=input()

for i in range(len(s)):
    k=ord(s[i])
    if(k<=67):
        k=k+23
    else:
        k=k-3
    print(chr(k), end="")

print("")

Submission status: Accepted

Solution code:
x=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
y=input()
z=list()
for i in range(len(y)):
  z.append(x[(x.index(y[i])-3)%26])
print(''.join(z))

Submission status: Accepted

Solution code:
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n =input()
for x in n:
  print(a[a.index(x)-3],end='')
print()

Submission status: Accepted

Solution code:
s=str(input())
for i in range(len(s)):
    a=ord(s[i])-3
    if a<65:
        a+=26
    print(chr(a), end='')
print()

Submission status: Accepted

Solution code:
n=list(input())
l=[]
for i in n:
    for j in range(68,91):
        if i == chr(j):
            m = chr(j-3)
            l.append(m)
    if i == 'A':
        m = 'X'
        l.append(m)
    elif i == 'B':
        m = 'Y'
        l.append(m)
    elif i == 'C':
        m = 'Z'
        l.append(m)
print(''.join(l))

Submission status: Accepted

Solution code:
#一文字ずつアルファベットを読み込む
#変更するときに特定してi+3にしてずらす
#大文字アルファベット
#入力1行

alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'#alpha[数]
ans = []
n = input()
for i in n:
    p = alpha[alpha.index(i)-3]#alpha[nのiはalpha.index番と等しい]
    ans.append(p)
print(*ans, sep = "")

Submission status: Accepted

Solution code:
a=input()
ans=[]
for i in range(len(a)):
    if 68<=ord(a[i])<=90:
        A=chr(ord(a[i])-3)
        ans.append(A)
    else:
        if a[i]=="A":
            ans.append("X")
        if a[i]=="B":
            ans.append("Y")
        if a[i]=="C":
            ans.append("Z")
print(*ans,sep="")

Submission status: Accepted

Solution code:
s=list(str(input()))
for i in range(len(s)):
    if s[i]=='A':
        s[i]='X'
    elif s[i]=='B':
        s[i]='Y'
    elif s[i]=='C':
        s[i]='Z'
    else:
        s[i]=chr(ord(s[i])-3)
print(''.join(s))

Submission status: Accepted

Solution code:
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
b='DEFGHIJKLMNOPQRSTUVWXYZABC'
n=input()
for i in range(len(n)):
    c=b.find(n[i])
    print(a[c],end="")
print("")

Submission status: Accepted

Solution code:
s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
S = 'DEFGHIJKLMNOPQRSTUVWXYZABC'
x = input()
a = []
for i in range(len(x)):
    for j in range(len(s)):
      if x[i] == S[j]:
         print(s[j], end='')
      else:
         pass
print()

Submission status: Accepted

Solution code:

a = input()
ans = []

for i in list(a):
    tmp = ord(i)
    if tmp==65: ans.append(chr(88))
    elif tmp==66: ans.append(chr(89))
    elif tmp==67: ans.append(chr(90))
    else: ans.append(chr(tmp-3))
    
print(*ans,sep="")

Submission status: Accepted

Solution code:
w=input()
list=[]
for i in range(len(w)):
    if w[i]=='C':
        list.append('Z')
        
    elif w[i]=='B':
        list.append('Y')
        
    elif w[i]=='A':
        list.append('X')
    else:
        c=ord(w[i])-3
        list.append(chr(c))
l=''.join(list)
print(l)

Submission status: Accepted

Solution code:
n=list(map(str,input()))
for i in range(0,len(n)):
    if n[i]>="D":
        n[i]=ord(n[i])
        n[i]=n[i]-3
        n[i]=chr(n[i])
    elif n[i]=="A":
        n[i]="X"
    elif n[i]=="B":
        n[i]="Y"
    else:
        n[i]="Z"
print("".join(n))

Submission status: Accepted

Solution code:
x=input()
def rot_n(s, n):
    answer = ''
    for letter in s:
        answer += chr(ord('A') + (ord(letter)-ord('A')-n) % 26)

    return answer
print(rot_n(x, 3))

Submission status: Accepted

Solution code:
alpha='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alpha2='DEFGHIJKLMNOPQRSTUVWXYZABC'
caesar=list(input())
for i in range(len(caesar)):
    for j in range(len(alpha2)):
        if caesar[i]==alpha2[j]:
            caesar[i]=alpha[j]
            print(caesar[i],end='')
            break
print('')

Submission status: Accepted

Solution code:



L=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

a=list(str(input()))
b=len(a)
for i in range(b):
    c=L.index(a[i])
    print(L[c-3],end="")
print()

Submission status: Accepted

Solution code:
l=[]
s=input()
for i in range(len(s)):
    m=ord(s[i])
    if m<68:
        l.append(chr(m+23))
    else:
        l.append(chr(m-3))
s=''.join(l)
print(s)

Submission status: Accepted

Solution code:
s=input()
s2=""
for i in s:
    if ord(i)>67:
        s2+=chr(ord(i)-3)
    else:
        s2+=chr(ord(i)+23)
print(s2)

Submission status: Accepted

Solution code:
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ALP = list(alp)

che = 'XYZABCDEFGHIJKLMNOPQRSTUVW'
CHE = list(che)

d = input()
D = list(d)

for i in range(len(D)):
    for j in range(len(ALP)):
        if D[i] == ALP[j]:
            D[i] = CHE[j]
            break

D = ''.join(D)
print(D)

Submission status: Accepted

Solution code:
#0512
word = list(input())
l = []


for i in range(len(word)):
    if ord(word[i]) == 65:
        l.append('X')
    elif ord(word[i]) == 66:
        l.append('Y')
    elif ord(word[i]) == 67:
        l.append('Z')
    else:
        l.append(chr(ord(word[i])-3))
print(''.join(l))

Submission status: Accepted

Solution code:
x=input()
l=len(x)
s=0
for i in x:
    s+=1
    if i=="A":
        print("X",end="")
    elif i=="B":
        print("Y",end="")
    elif i=="C":
        print("Z",end="")
    else:
        print(chr(ord(i)-3),end="")
    if s==l:
        print()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
bef = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
aft = "DEFGHIJKLMNOPQRSTUVWXYZABC"

s = list(input())
for i in range(len(s)):
   for j in range(len(aft)):
      if s[i] == aft[j]:
         #print("@", aft[j], bef[j])
         s[i] = bef[j]
         print(s[i], end = "")
         break
print("")

Submission status: Accepted

Solution code:
s = list(str(input()))
l = len(s)
a = ''
for i in range(l):
    x = ord(s[i])
    y = x-3
    if y < 65:
        y += 26
    z = chr(y)
    a += z

print(a)

Submission status: Accepted

Solution code:
n = list(input())

ans=[]
b = 0
for i in n:
    if ord(i) == ord("A"):
        ans.append("X")
    elif ord(i) == ord("B"):
        ans.append("Y")
    elif ord(i) == ord("C"):
        ans.append("Z")
    else:
        b = chr(ord(i)-3)
        ans.append(b)

ans = [str(i) for i in ans]
ans = "".join(ans)
print(ans)

Submission status: Accepted

Solution code:
def derot_n(s, n):
    ans = ''
    for letter in s:
        ans += chr(ord('Z') - (ord('Z')-ord(letter)+n) % 26)
    return ans
    
print(derot_n(input(), 3))

Submission status: Accepted

Solution code:
import string
lst=string.ascii_uppercase
lst2=lst[3:]+lst[:3]
dic=dict(zip(lst2,lst))

n=list(input())
x=[]
for i in n:
    x.append(dic[i])
print("".join(n for n in x))

Submission status: Accepted

Solution code:
s = list(input())
n = []
for i in range(len(s)) :
    if 65 <= ord(s[i]) <= 67 :
        n.append(chr(ord(s[i])+23))
    else :
        n.append(chr(ord(s[i])-3))
print(*n, sep="")

Submission status: Accepted

Solution code:
dict = {}
dict['A'] = 'X'
dict['B'] = 'Y'
dict['C'] = 'Z'
dict['D'] = 'A'
dict['E'] = 'B'
dict['F'] = 'C'
dict['G'] = 'D'
dict['H'] = 'E'
dict['I'] = 'F'
dict['J'] = 'G'
dict['K'] = 'H'
dict['L'] = 'I'
dict['M'] = 'J'
dict['N'] = 'K'
dict['O'] = 'L'
dict['P'] = 'M'
dict['Q'] = 'N'
dict['R'] = 'O'
dict['S'] = 'P'
dict['T'] = 'Q'
dict['U'] = 'R'
dict['V'] = 'S'
dict['W'] = 'T'
dict['X'] = 'U'
dict['Y'] = 'V'
dict['Z'] = 'W'

for s in input().strip():
	print(dict[s], end='')
print()

Submission status: Accepted

Solution code:
X = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
Y = 'DEFGHIJKLMNOPQRSTUVWXYZABC'
text = list(input())
clist = []
for i in range(len(text)):
    c = Y.find(text[i])
    clist.append(X[c])
print(''.join(clist))

Submission status: Accepted

Solution code:
A = [chr(i) for i in range(65, 65 + 26)]
# アルファベット大文字一覧表

D = [chr(i) for i in range(68, 68 + 23)]
D.append("A")
D.append("B")
D.append("C")
# シーザー暗号変換後アルファベット大文字一覧表

n = input()
ANS = []

for i in range(len(n)) :
    ANS.append(A[D.index(n[i])])
    
for i in range(len(ANS)) :
    if i == len(ANS) - 1 :
        print(ANS[i])
    else :
        print(ANS[i], end = "")

Submission status: Accepted

Solution code:
n=list(map(str,input()))
for i in range(0,len(n)):
    if n[i]>="D":
        n[i]=ord(n[i])
        n[i]=n[i]-3
        n[i]=chr(n[i])
    elif n[i]=="A":
        n[i]="X"
    elif n[i]=="B":
        n[i]="Y"
    else:
        n[i]="Z"
print("".join(n))

Submission status: Accepted

Solution code:
#入力し文字一つ一つにわける
str1 = [a for a in input()]
str2 = []

#文字を数字に変換し、シーザー暗号を変換して戻す
for num in str1:
    num1 = ord(num)
    if num1 < 68:
        num1 += 26
    num1 -= 3
    str2.append(chr(num1))
    
#出力
str2 = "".join(str2)
print(str2)

Submission status: Accepted

Solution code:
L=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
S=input()
Z=list()
for i in range(len(S)):
  Z.append(L[(L.index(S[i])-3)%26])
print(''.join(Z))

Submission status: Accepted

Solution code:
import string

alpha = string.ascii_uppercase
text = input()
ans = ""
for t in text:
    new_ind = alpha.index(t) - 3
    ans += alpha[new_ind]
print(ans)

Submission status: Accepted

Solution code:
s = input()
for i in range(len(s)):
    a = ord(s[i])-3
    if a < 65:
        a = a + 26
    print(chr(a), end='')
print()

Submission status: Accepted

Solution code:
alph=[chr(i) for i in range(97,97+26)]
alph_3=alph[3:26]+alph[0:3]
alph_3=[i.upper() for i in alph_3]
alph=[[alph_3[i],alph[i]] for i in range(26)]
S=[i for i in input()]
for i in range(len(S)):
    for j in range(26):
        if S[i]==alph[j][0]:
            S[i]=alph[j][1]
S="".join(S)
print(S.upper())

Submission status: Accepted

Solution code:
d = dict()

for i in range(26):
    a = chr( i + ord("A") )
    b = chr( (i+3)%26 + ord("A"))
    d[b] = a


s = input()
L = []

for i in s:
    L.append(d[i])
    
print("".join(L))

Submission status: Accepted

Solution code:
def main():
    s = input()
    temp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    ans = []
    for c in s:
        ans.append(temp[(temp.index(c) - 3) % 26])

    print(''.join(ans))
    

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
before = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
after = list("DEFGHIJKLMNOPQRSTUVWXYZABC")

string = input()

ans = ""
for s in string:
  ans += before[after.index(s)]
print(ans)

Submission status: Accepted

Solution code:
before = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
after = list("DEFGHIJKLMNOPQRSTUVWXYZABC")

string = input()

ans = ""
for s in string:
    ans += before[after.index(s)]

print(ans)

Submission status: Accepted

Solution code:
s = input().strip()
base = ord('A')
print(''.join(chr((ord(c)-3-base)%26+base) for c in s))

Submission status: Accepted

Solution code:
def change(hoge):
    if hoge == 'A':
        return 'X'
    if hoge == 'B':
        return 'Y'
    if hoge == 'C':
        return 'Z'
    if hoge == 'D':
        return 'A'
    if hoge == 'E':
        return 'B'
    if hoge == 'F':
        return 'C'
    if hoge == 'G':
        return 'D'
    if hoge == 'H':
        return 'E'
    if hoge == 'I':
        return 'F'
    if hoge == 'J':
        return 'G'
    if hoge == 'K':
        return 'H'
    if hoge == 'L':
        return 'I'
    if hoge == 'M':
        return 'J'
    if hoge == 'N':
        return 'K'
    if hoge == 'O':
        return 'L'
    if hoge == 'P':
        return 'M'
    if hoge == 'Q':
        return 'N'
    if hoge == 'R':
        return 'O'
    if hoge == 'S':
        return 'P'
    if hoge == 'T':
        return 'Q'
    if hoge == 'U':
        return 'R'
    if hoge == 'V':
        return 'S'
    if hoge == 'W':
        return 'T'
    if hoge == 'X':
        return 'U'
    if hoge == 'Y':
        return 'V'
    if hoge == 'Z':
        return 'W' 

before = list(raw_input())
after = []
for i in range(len(before)):
    after.append(change(before[i]))
print ''.join(after)

Submission status: Runtime Error

Solution code:
x = input()

str_list = list(x)
dict_ = {

    }

for a in str_list:
    if ord(a) - 3 < 65:
        print(chr(90 - 65 - ord(a) - 3) ,end = "")
    else:
        print(chr(ord(a) - 3) ,end = "")
print()

Submission status: Runtime Error

Solution code:
def main():
    d = list(input())
    alp = [chr(i) for i in range(65, 65 + 26)]

    for x in range(len(d)):
        idx = alp.index(d[x]) - 3
        if idx < 0:
            idx = 26 - idx
        else:
            pass
        d[x] = alp[idx]

    ans = ""
    for x in d:
        ans += x
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
dic="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
code=raw_input()
ans=""
for w in code:
	ans+=dic[(dic.index(w)+24)%27]
print ans

Submission status: WA: Presentation Error

Solution code:
import string

a_to_z = string.ascii_uppercase

input_string = input()

for s in input_string:
    print(chr(((ord(s) - ord('A') - 3) % 26 + ord('A'))), end='')

Submission status: WA: Presentation Error

Solution code:
ch = input()
for i in range(len(ch)):
    num = ord(ch[i])
    if num>=68:
        num -= 3
    else:
        num += 23
    ans = chr(num)
    print(ans, end='')

Submission status: WA: Presentation Error

Solution code:
ch = input()
ans = []
for i in range(len(ch)):
    num = ord(ch[i])
    if num>=68:
        num -= 3
    else:
        num += 23
    ans.append(chr(num))

for i in range(len(ans)):
    print(ans[i], end='')

Submission status: WA: Presentation Error

Solution code:
z='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for x in input():print(z[z.index(x)-3],end='')