s_id
stringlengths 10
10
| p_id
stringlengths 6
6
| u_id
stringlengths 10
10
| date
stringlengths 10
10
| language
stringclasses 1
value | original_language
stringclasses 11
values | filename_ext
stringclasses 1
value | status
stringclasses 1
value | cpu_time
int64 0
100
| memory
stringlengths 4
6
| code_size
int64 15
14.7k
| code
stringlengths 15
14.7k
| problem_id
stringlengths 6
6
| problem_description
stringlengths 358
9.83k
| input
stringlengths 2
4.87k
| output
stringclasses 807
values | __index_level_0__
int64 1.1k
1.22M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
s037582288
|
p00017
|
u150984829
|
1516943890
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5572
| 186
|
import sys
for b in sys.stdin:
for i in range(26):
c=''.join([e,chr((ord(e)-96+i)%26+97)][96<ord(e)<123]for e in b)
if any(('the'in c,'this'in c,'that'in c)):print(c.strip());break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,502
|
s202813884
|
p00017
|
u150984829
|
1516943950
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5572
| 180
|
import sys
for b in sys.stdin:
for i in range(26):
c=''.join([e,chr((ord(e)-96+i)%26+97)][96<ord(e)<123]for e in b)
if any(('the'in c,'this'in c,'that'in c)):print(c.strip())
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,503
|
s181717654
|
p00017
|
u150984829
|
1516943953
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5568
| 180
|
import sys
for b in sys.stdin:
for i in range(26):
c=''.join([e,chr((ord(e)-96+i)%26+97)][96<ord(e)<123]for e in b)
if any(('the'in c,'this'in c,'that'in c)):print(c.strip())
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,504
|
s538019290
|
p00017
|
u150984829
|
1516943955
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5572
| 180
|
import sys
for b in sys.stdin:
for i in range(26):
c=''.join([e,chr((ord(e)-96+i)%26+97)][96<ord(e)<123]for e in b)
if any(('the'in c,'this'in c,'that'in c)):print(c.strip())
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,505
|
s456015066
|
p00017
|
u150984829
|
1516943956
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5568
| 180
|
import sys
for b in sys.stdin:
for i in range(26):
c=''.join([e,chr((ord(e)-96+i)%26+97)][96<ord(e)<123]for e in b)
if any(('the'in c,'this'in c,'that'in c)):print(c.strip())
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,506
|
s852476954
|
p00017
|
u273843182
|
1521350358
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5568
| 288
|
l = 'abcdefghijklmnopqrstuvwxyz'
while True:
try:
s = input()
except:
exit()
for d in range(1,27):
t = s[:-1].translate(str.maketrans(l,l[d:] + l[:d]))
if 'that' in t or 'this' in t or 'the' in t:
print(t + '.')
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,507
|
s068761251
|
p00017
|
u166871988
|
1523754485
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5564
| 401
|
def dec(text,d):
r=[]
for i in text:
c=ord(i)
if c<65:r.append(i)
elif c<91:r.append(chr((c-65+d)%26+65))
else:r.append(chr((c-97+d)%26+97))
return "".join(r)
while True:
try:raw=input()
except:break
if raw=="":break
for i in range(26):
d=dec(raw,i)
if sum([1 for i in ["the","this","that"] if i in d])>0:break
print(d)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,508
|
s022022118
|
p00017
|
u724548524
|
1525753095
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5564
| 246
|
import sys
a = "abcdefghijklmnopqrstuvwxyz"
x = str.maketrans(a, a[1:] + a[:1])
for s in sys.stdin:
while True:
s = s.translate(x)
if "the" in s or "that" in s or "this " in s:
print(s, end = "")
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,509
|
s993128699
|
p00017
|
u352394527
|
1527224906
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5568
| 380
|
basea = ord("a")
basez = ord("z")
def slide(c):
ordc = ord(c)
diff = ordc - basea
diff += 1
diff %= 26
return chr(basea + diff)
while True:
try:
s = input()
while True:
if "the" in s or "this" in s or "that" in s:
print(s)
break
s = "".join([slide(c) if basea <= ord(c) <= basez else c for c in s])
except EOFError:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,510
|
s962312919
|
p00017
|
u136916346
|
1529174538
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5576
| 719
|
import sys
def l(s,n):
o=ord(s.lower())
if not 97<=o<=122:
return s
if 97<=o+n<=122:
if 97<=ord(s)<=122:
return chr(o+n)
else:
return chr(o+n).upper()
elif o+n>122:
if 97<=ord(s)<=122:
return chr(o+n-26)
else:
return chr(o+n-26).upper()
else:
if 97<=ord(s)<=122:
return chr(o+n+26)
else:
return chr(o+n+26).upper()
for t in sys.stdin:
s=t[:-1]
u=s.lower()
for i in range(0,26):
cv=lambda y:"".join(map(lambda x:l(x,i),y))
if cv("this") in u or cv("that") in u or cv("the") in u:
break
print("".join(map(lambda x:l(x,-i),s)))
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,511
|
s964147280
|
p00017
|
u847467233
|
1529587058
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5564
| 438
|
# AOJ 0017 Caesar Cipher
# Python3 2018.6.21 bal4u
ch = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
while 1:
try: s = list(input())
except: break
n = len(s)
for i in range(26):
t = ['']*n
for j in range(n):
if s[j] >= 'a' and s[j] <= 'z':
t[j] = ch[ord(s[j])-ord('a')+i]
else: t[j] = s[j]
tt = ''.join(t)
t = list(tt.split());
if ("the" in t) or ("this" in t) or ("that" in t):
print(tt)
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,512
|
s014836334
|
p00017
|
u719737030
|
1351667120
|
Python
|
Python
|
py
|
Accepted
| 20
|
4236
| 415
|
import sys
def ceaser_decode(text):
d={}
line=""
for n in range(26):
for c in (65,97):
for i in range(26):
d[chr(i+c)] = chr((i+n)%26+c)
line = "".join([d.get(c,c) for c in text])
if line.find("the")!=-1 or line.find("this")!=-1 or line.find("that")!=-1:
break
return line
for i in sys.stdin.readlines():
print ceaser_decode(i),
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,513
|
s283108863
|
p00017
|
u280179677
|
1356048818
|
Python
|
Python
|
py
|
Accepted
| 20
|
4392
| 858
|
#! /usr/bin/python
import sys
from string import ascii_lowercase, whitespace
def datasets():
for line in sys.stdin:
yield line.strip()
hints = ('the', 'this', 'that')
inclement_chars = lambda cs, n: ''.join(
[succ_char(c, n)
if all([c not in case for case in (whitespace, '.', '\n')])
else c
for c in cs])
make_picklist = lambda s: [inclement_chars(s, n) for n in range(1, 27)]
def main():
for problem in datasets():
picklist = make_picklist(problem)
for n, candidate in enumerate(picklist, 1):
if any([case in candidate for case in hints]):
break
print picklist[n-1]
def succ_char(c, n):
succ_ord = ord(c)+n
z = ord('z')
if succ_ord > z:
succ_ord = ord('a') + (succ_ord - z - 1)
return chr(succ_ord)
if __name__ == '__main__':
main()
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,514
|
s048279021
|
p00017
|
u419407022
|
1356089725
|
Python
|
Python
|
py
|
Accepted
| 10
|
47000
| 420
|
def cipher(char):
if ord(char) <= ord('y') and ord(char) >= ord('a'):
return str(chr(ord(char) + 1))
elif char == 'z':
return 'a'
else:
return char
while True:
try:
sent = raw_input()
except EOFError:
break
while((sent.find('the') == -1) and (sent.find('this') == -1) and (sent.find('that') == -1)):
sent = ''.join(map(cipher, sent))
print sent
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,515
|
s591260824
|
p00017
|
u290605490
|
1356505437
|
Python
|
Python
|
py
|
Accepted
| 10
|
4232
| 428
|
def trans(s):
s1=""
for c in s:
if c.isalpha():
s1+=chr(ord(c)+1)
else:
s1+=c
return s1.replace("{","a")
while True:
try:
s=raw_input()
except EOFError:
break
cnt=0
the,this,that="the","this","that"
while True:
if (the in s) or (this in s) or (that in s):
print s
break
else:
s=trans(s)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,516
|
s168287855
|
p00017
|
u647766105
|
1356550425
|
Python
|
Python
|
py
|
Accepted
| 10
|
5336
| 414
|
import sys
def decode(s):
result=""
for c in s:
if not (c==" " or c=="."):
result+=chr(ord(c)+1)
else:
result+=c
return result.replace(chr(ord("z")+1),"a")
for line in sys.stdin.readlines():
s=line.strip()
for i in xrange(ord("z")-ord("a")+1):
if "the" in s or "that" in s or "this" in s:
print s
break
s=decode(s)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,517
|
s734813000
|
p00017
|
u782850731
|
1362099633
|
Python
|
Python
|
py
|
Accepted
| 20
|
4424
| 437
|
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from sys import stdin
from string import ascii_lowercase as letters, maketrans
table = maketrans(letters, letters[1:] + letters[:1])
for line in stdin:
line = line.strip()
while True:
line = line.translate(table)
if 'the ' in line or 'this ' in line or 'that ' in line:
break
print(line)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,518
|
s465428567
|
p00017
|
u743065194
|
1363922850
|
Python
|
Python
|
py
|
Accepted
| 20
|
4232
| 321
|
'''
Created on Mar 22, 2013
@author: wukc
'''
from sys import stdin
def shift(s):
return ["".join([chr(97+(ord(x)-97+t)%26) if x.islower() else x for x in s]) for t in range(26)]
target=["this","the","that"]
for s in stdin:
for x in shift(s):
if sum(map(x.count,target))>0:
print(x[:-1])
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,519
|
s068156649
|
p00017
|
u282635979
|
1363944174
|
Python
|
Python
|
py
|
Accepted
| 10
|
4264
| 715
|
alpha = 'abcdefghijklmnopqrstuvwxyz'
alp_num = dict(zip(alpha,range(26)))
num_alp = dict(zip(range(26),alpha))
alp_num[' ']=' ' ; num_alp[' ']=' ' ; alp_num['.']='.' ; num_alp['.']='.'
while True:
try:
cipher = raw_input()
numcipher = [alp_num[val] for val in cipher]
while True:
cipher = ''
for val in numcipher: cipher += str(num_alp[val])
if 'the'in cipher or 'this'in cipher or 'that'in cipher:
print cipher; break
else:
numcipher2 = []
for val in numcipher:
if val == ' ': numcipher2.append(' ')
elif val == '.': numcipher2.append('.')
elif val == 25: numcipher2.append(0)
else: numcipher2.append(val+1)
numcipher = numcipher2
continue
except: break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,520
|
s760471604
|
p00017
|
u282635979
|
1363944461
|
Python
|
Python
|
py
|
Accepted
| 20
|
4264
| 715
|
alpha = 'abcdefghijklmnopqrstuvwxyz'
alp_num = dict(zip(alpha,range(26)))
num_alp = dict(zip(range(26),alpha))
alp_num[' ']=' ' ; num_alp[' ']=' ' ; alp_num['.']='.' ; num_alp['.']='.'
while True:
try:
cipher = raw_input()
numcipher = [alp_num[val] for val in cipher]
while True:
cipher = ''
for val in numcipher: cipher += str(num_alp[val])
if 'the'in cipher or 'this'in cipher or 'that'in cipher:
print cipher; break
else:
numcipher2 = []
for val in numcipher:
if val == ' ': numcipher2.append(' ')
elif val == '.': numcipher2.append('.')
elif val == 25: numcipher2.append(0)
else: numcipher2.append(val+1)
numcipher = numcipher2
continue
except: break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,521
|
s343626168
|
p00017
|
u147801965
|
1366133011
|
Python
|
Python
|
py
|
Accepted
| 20
|
4220
| 243
|
import sys
a=lambda x: [''.join([chr(97+(ord(i)-97+j)%26) if i.islower() else i for i in x]) for j in range(26)]
value=['this','that','the']
for s in sys.stdin:
for i in a(s):
if sum(map(i.count,value))>0:
print(i[:-1])
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,522
|
s722582320
|
p00017
|
u542421762
|
1368196420
|
Python
|
Python
|
py
|
Accepted
| 20
|
4260
| 969
|
import sys
import re
def shift(lis):
a = lis.pop()
lis.insert(0, a)
return lis
class Caesar:
def __init__(self, n):
a = list("abcdefghijklmnopqrstuvwxyz")
b = list("abcdefghijklmnopqrstuvwxyz")
for i in range(n):
b = shift(b)
# self.table = map((lambda x, y: (x, y)), a, b)
self.table = zip(a, b)
def lookup(self, c):
for p in self.table:
if c == p[0]:
c = p[1]
break
return c
def decrypt(self, str):
result = map(self.lookup, str)
return "".join(result)
#input_file = open(sys.argv[1], "r")
r = re.compile("the|this|that")
#for line in input_file:
for line in sys.stdin:
line = line.rstrip("\r\n")
for n in range(1,27):
caesar = Caesar(n)
result = caesar.decrypt(line)
m = r.findall(result)
if not len(m) == 0:
# print m
break
print result
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,523
|
s846663639
|
p00017
|
u912237403
|
1377891359
|
Python
|
Python
|
py
|
Accepted
| 10
|
4232
| 414
|
import sys
def decode(s):
result=""
for c in s:
if not (c==" " or c=="."):
result+=chr(ord(c)+1)
else:
result+=c
return result.replace(chr(ord("z")+1),"a")
for line in sys.stdin.readlines():
s=line.strip()
for i in xrange(ord("z")-ord("a")+1):
if "the" in s or "that" in s or "this" in s:
print s
break
s=decode(s)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,524
|
s436076669
|
p00017
|
u912237403
|
1377905582
|
Python
|
Python
|
py
|
Accepted
| 20
|
4236
| 523
|
def rot(s):
x=""
for c in s:
tmp = ord(c)-ord("a")
if "a"<=c<="z":
x += chr((tmp+1) % 26 + ord("a"))
else:
x += c
return x
while True:
try:
s = raw_input()
f = False
for i in range(26):
for word in s.split():
if word=="the" or word=="this" or word=="that":
f=True
break
if f: break
else: s=rot(s)
print s
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,525
|
s584345536
|
p00017
|
u912237403
|
1377906101
|
Python
|
Python
|
py
|
Accepted
| 20
|
4236
| 522
|
def rot(s):
x=""
for c in s:
tmp = ord(c)-ord("a")
if "a"<=c<="z":
x += chr((tmp+1) % 26 + ord("a"))
else:
x += c
return x
def check(s):
for word in s.split():
if word=="the" or word=="this" or word=="that":
return True
else: return False
while True:
try:
s = raw_input()
f = False
for i in range(26):
if check(s):break
else: s=rot(s)
print s
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,526
|
s739206385
|
p00017
|
u813384600
|
1379500898
|
Python
|
Python
|
py
|
Accepted
| 10
|
4228
| 454
|
while True:
try:
s = raw_input()
for i in range(26):
r = ''
for c in s:
if c.islower():
n = ord(c) - ord('a') + i
n = n % 26
r += chr(n + ord('a'))
else:
r += c
if 'the' in r or 'this' in r or 'that' in r:
print r
break
except EOFError:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,527
|
s893529899
|
p00017
|
u523886269
|
1381333019
|
Python
|
Python
|
py
|
Accepted
| 20
|
4300
| 996
|
#!/usr/bin/python
import sys
itoa = {
1:'a', 2:'b', 3:'c', 4:'d', 5:'e',
6:'f', 7:'g', 8:'h', 9:'i',10:'j',
11:'k',12:'l',13:'m',14:'n',15:'o',
16:'p',17:'q',18:'r',19:'s',20:'t',
21:'u',22:'v',23:'w',24:'x',25:'y',
26:'z'
}
atoi = {
'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5,
'f': 6, 'g': 7, 'h': 8, 'i': 9, 'j':10,
'k':11, 'l':12, 'm':13, 'n':14, 'o':15,
'p':16, 'q':17, 'r':18, 's':19, 't':20,
'u':21, 'v':22, 'w':23, 'x':24, 'y':25,
'z':26
}
def main():
for crypt in sys.stdin:
for i in xrange(1, 27):
decrypt = decryptor(crypt.strip(), i)
if (decrypt.find('the') != -1
or decrypt.find('this') != -1
or decrypt.find('that') != -1):
print decrypt
break
def decryptor(crypt, offset):
global atoi
global itoa
decrypt = ''
for c in crypt:
if (c == ' ' or c == ',' or c == '.' or c == "\n"):
decrypt += c
else:
code = atoi[c]
code -= offset
if (code <= 0 ):
code = 26 + code
decrypt += str(itoa[code])
return decrypt
main()
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,528
|
s074053326
|
p00017
|
u351182591
|
1381925913
|
Python
|
Python
|
py
|
Accepted
| 20
|
4224
| 583
|
b = ["the", "this", "that"]
while 1:
try:
a = raw_input()
except EOFError:
break
for y in range(26):
for x in b:
if x in a:
print a
break
a = list(a)
for x in range(len(a)):
if a[x] == "z":
a[x] = "a"
elif "a" <= a[x] < "z":
a[x] = chr(ord(a[x])+1)
a = "".join(a)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,529
|
s104504110
|
p00017
|
u093607836
|
1382952486
|
Python
|
Python
|
py
|
Accepted
| 10
|
4372
| 217
|
import sys,string
t = string.maketrans('abcdefghijklmnopqrstuvwxyz','bcdefghijklmnopqrstuvwxyza')
for s in sys.stdin:
s = s.strip()
while not ('the' in s or 'this' in s or 'that' in s):
s = s.translate(t)
print s
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,530
|
s897629844
|
p00017
|
u230836528
|
1392306520
|
Python
|
Python
|
py
|
Accepted
| 20
|
4220
| 543
|
import sys
lineNumber = 0
#for line in [ "xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt." ]:
for line in sys.stdin.readlines():
lineNumber += 1
# get data
# List = map(float, line.strip().split(","))
s = line.strip()
for i in xrange(1, 26+1):
for idx in xrange( len(s) ):
n = ord(s[idx])
if n < 97 or n >= 97+26: continue
n += - 97 + 1
n %= 26
s = s[:idx] + chr(n + 97) + s[idx+1:]
if "this" in s or "that" in s or "the" in s: break
print s
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,531
|
s765022221
|
p00017
|
u633068244
|
1393370711
|
Python
|
Python
|
py
|
Accepted
| 20
|
4236
| 552
|
alpha = ["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"]
sign = [" ", ".", "," ,":"]
while True:
try:
word = raw_input()
for key in range(26):
for i in range(len(word)):
if not word[i] in sign:
ref = alpha.index(word[i])
word = word[:i]+alpha[(ref+1)%26]+word[i+1:]
if word.count("the ")>=1 or word.count("that")>=1 or word.count("this")>=1:
print word
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,532
|
s667379500
|
p00017
|
u858885710
|
1393944910
|
Python
|
Python
|
py
|
Accepted
| 10
|
4208
| 428
|
import sys
alphabet = 'abcdefghijklmnopqrstuvwxyz'
def shift(arg):
tmp = arg.rstrip()
while True:
res = ''
for c in tmp:
if c in alphabet:
if c == 'a': res += 'z'
else: res += chr(ord(c)-1)
else: res += c
if 'the' in res or 'this' in res or 'that' in res:
return res
tmp = res
for trg in sys.stdin:
print shift(trg)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,533
|
s160966121
|
p00017
|
u912237403
|
1393946762
|
Python
|
Python
|
py
|
Accepted
| 10
|
4212
| 377
|
import sys
def decode(s):
x=""
for c in s:
if not (c==" " or c=="."):
x+=chr(ord(c)+1)
else:
x+=c
return x.replace(chr(ord("z")+1),"a")
for s in sys.stdin.readlines():
for i in xrange(ord("z")-ord("a")+1):
if "the" in s or "that" in s or "this" in s:
print s[:-1]
break
s=decode(s)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,534
|
s794051472
|
p00017
|
u912237403
|
1393946975
|
Python
|
Python
|
py
|
Accepted
| 10
|
4216
| 365
|
import sys
def decode(s):
x=""
for c in s:
if c in " .":
x+=c
else:
x+=chr(ord(c)+1)
return x.replace(chr(ord("z")+1),"a")
for s in sys.stdin.readlines():
for i in xrange(ord("z")-ord("a")+1):
if "the" in s or "that" in s or "this" in s:
print s[:-1]
break
s=decode(s)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,535
|
s558698966
|
p00017
|
u912237403
|
1393947344
|
Python
|
Python
|
py
|
Accepted
| 10
|
4212
| 302
|
import sys
def decode(s):
x=""
for c in s:
if c in " .": x+=c
else: x+=chr(ord(c)+1)
return x.replace(chr(ord("z")+1),"a")
for s in sys.stdin.readlines():
for i in range(26):
if "the" in s or "that" in s or "this" in s:break
s=decode(s)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,536
|
s787236741
|
p00017
|
u912237403
|
1393947804
|
Python
|
Python
|
py
|
Accepted
| 10
|
4204
| 304
|
import sys
A="abcdefghijklmnopqrstuvwxyza"
def decode(s):
x=""
for c in s:
if c in A: x+=A[A.index(c)+1]
else: x+=c
return x
for s in sys.stdin.readlines():
for i in range(26):
if "the" in s or "that" in s or "this" in s:break
s=decode(s)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,537
|
s752235799
|
p00017
|
u912237403
|
1393948099
|
Python
|
Python
|
py
|
Accepted
| 20
|
4204
| 297
|
import sys
A="abcdefghijklmnopqrstuvwxyza"
def rot(s):
x=""
for c in s:
if c in A:x+=A[A.index(c)+1]
else:x+=c
return x
for s in sys.stdin.readlines():
for i in range(26):
if "the" in s or "that" in s or "this" in s:break
s=rot(s)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,538
|
s884482593
|
p00017
|
u912237403
|
1393948653
|
Python
|
Python
|
py
|
Accepted
| 20
|
4376
| 216
|
import sys,string
A="abcdefghijklmnopqrstuvwxyz"
tbl=string.maketrans(A,A[1:]+A[0])
for s in sys.stdin.readlines():
while not("the" in s or "that" in s or "this" in s):
s=s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,539
|
s649990865
|
p00017
|
u912237403
|
1393948801
|
Python
|
Python
|
py
|
Accepted
| 10
|
4208
| 275
|
import sys
A="abcdefghijklmnopqrstuvwxyza"
def rot(s):
x=""
for c in s:
if c in A: x+=A[A.index(c)+1]
else: x+=c
return x
for s in sys.stdin.readlines():
while not("the" in s or "that" in s or "this" in s):
s=rot(s)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,540
|
s265240234
|
p00017
|
u912237403
|
1393949073
|
Python
|
Python
|
py
|
Accepted
| 10
|
4372
| 217
|
import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin.readlines():
while not("the" in s or "that" in s or "this" in s):
s=s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,541
|
s495643015
|
p00017
|
u912237403
|
1393949197
|
Python
|
Python
|
py
|
Accepted
| 10
|
4376
| 205
|
import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin:
while not("the" in s or "that" in s or "this" in s):
s=s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,542
|
s435305423
|
p00017
|
u193025715
|
1395392188
|
Python
|
Python
|
py
|
Accepted
| 20
|
4368
| 205
|
import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin:
while not("the" in s or "that" in s or "this" in s):
s=s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,543
|
s616290235
|
p00017
|
u193025715
|
1395392300
|
Python
|
Python
|
py
|
Accepted
| 10
|
4372
| 215
|
import string, sys
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
while not('the' in s or 'that' in s or 'this' in s):
s = s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,544
|
s897193738
|
p00017
|
u023846178
|
1395817218
|
Python
|
Python
|
py
|
Accepted
| 10
|
4372
| 296
|
import sys,string
A = 'abcdefghijklmnopqrstuvwxyza'
rot = string.maketrans(A[1:], A[:-1])
for line in sys.stdin:
line = line[:-1]
while 1:
if line.count("the") or line.count("this") or line.count("that"):
print line
break
line = line.translate(rot)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,545
|
s935066119
|
p00017
|
u491763171
|
1396398005
|
Python
|
Python
|
py
|
Accepted
| 20
|
4220
| 473
|
def decode(string, num):
a, z = ord('a'), ord('z')
return ''.join([chr(((ord(s) - a) + num) % 26 + a) if a <= ord(s) <= z else s for s in string])
while 1:
try:
line = raw_input()
for i in range(26):
tmp = decode(line, i)
for x in tmp.split():
x = x.strip('.')
if 'this' in x or 'the' in x or 'that' in x:
print tmp
break
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,546
|
s637327223
|
p00017
|
u246033265
|
1396615661
|
Python
|
Python
|
py
|
Accepted
| 10
|
4240
| 613
|
a = [['the'], ['this'], ['that']]
for i in range(25):
for b in a:
s = ''
for c in b[-1]:
s += chr((ord(c) - ord('a') + 1) % 26 + ord('a'))
b.append(s)
def f(s):
for b in a:
for i in range(26):
if s.find(b[i]) != -1:
t = ''
for c in s:
if c.isalpha():
t += chr((ord(c) - ord('a') - i + 26) % 26 + ord('a'))
else:
t += c
return t
return None
try:
while True:
print f(raw_input())
except:
pass
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,547
|
s029217443
|
p00017
|
u708217907
|
1398381858
|
Python
|
Python
|
py
|
Accepted
| 10
|
4372
| 219
|
import string, sys
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
while not('the' in s or 'that' in s or 'this' in s):
s = s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,548
|
s977061343
|
p00017
|
u708217907
|
1398382006
|
Python
|
Python
|
py
|
Accepted
| 10
|
4368
| 217
|
import sys, string
alpha = 'abcdefghijklmnopqrstuvwxyza'
tbl = string.maketrans(alpha[:-1], alpha[1:])
for s in sys.stdin:
while not('the' in s or 'this' in s or 'that' in s):
s = s.translate(tbl)
print s[:-1]
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,549
|
s837024975
|
p00017
|
u436634575
|
1401137427
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6720
| 256
|
a = 'abcdefghijklmnopqrstuvwxyz'
while True:
try:
s = input()
except:
break
for n in range(1, 27):
t = s.translate(str.maketrans(a, a[n:] + a[:n]))
if 'the' in t or 'this' in t or 'that' in t: break
print(t)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,550
|
s975746586
|
p00017
|
u436634575
|
1401139013
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6724
| 225
|
import sys
a = 'abcdefghijklmnopqrstuvwxyz'
for s in sys.stdin:
for n in range(1, 27):
t = s[:-1].translate(str.maketrans(a, a[n:] + a[:n]))
if 'the' in t or 'this' in t or 'that' in t: break
print(t)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,551
|
s327240013
|
p00017
|
u240091169
|
1594512729
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5560
| 593
|
while True :
try :
string = input()
except EOFError :
break
for i in range(26) :
new_string = []
for j in range(len(string)) :
if 97 <= ord(string[j]) <= 122 :
x = ord(string[j]) + i
if x > 122 :
x -= 26
new_string.append(chr(x))
else :
new_string.append(string[j])
new_string = ''.join(new_string)
if 'the' in new_string or 'this' in new_string or 'that' in new_string :
print(new_string)
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,552
|
s646383138
|
p00017
|
u187074069
|
1594212940
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5556
| 518
|
def rot(s, n):
anslet = ''
for let in s:
if let in alp:
anslet = anslet + chr(ord('a') + (ord(let) - ord('a') + n) % 26)
else:
anslet = anslet + let
return anslet
alp = 'abcdefghijklmnopqrstuvwxyz'
while True:
try:
letlst = input()
except:
break
for i in range(27):
word = rot(letlst, i)
if ('this' in word) or('that' in word) or ('the' in word):
num = i
letlst = rot(letlst, num)
print(letlst)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,553
|
s791284598
|
p00017
|
u630911389
|
1591255415
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5556
| 541
|
def slide(c):
c = ord(c) + 1
if c > ord('z'):
c = ord('a')
return chr(c)
while 1:
try:
s = input()
ans = ""
while 1:
if "the" in s or "this" in s or "that" in s:
print(s)
break
for i in range(0,len(s)):
if ord(s[i]) >= ord('a') and ord(s[i]) <= ord('z'):
ans += slide(s[i])
else:
ans += s[i]
s = ans
ans = ""
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,554
|
s274357987
|
p00017
|
u260980560
|
1588730936
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5564
| 387
|
ca = ord('a')
def convert(s, d):
res = []
for c in s:
if c not in ' .':
c = chr(((ord(c) - ca + d) % 26) + ca)
res.append(c)
return "".join(res)
for line in open(0).readlines():
s = line.strip()
for d in range(26):
s0 = convert(s, d)
if "the" in s0 or "this" in s0 or "that" in s0:
print(s0)
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,555
|
s095396366
|
p00017
|
u803862921
|
1570840317
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5560
| 458
|
def cipher(s, k):
l = list(s)
r = []
for i in l:
if i.islower():
i = chr((ord(i) - ord('a') + k)%26 + ord('a'))
r.append(i)
return "".join(r)
while True:
wordset = { "this", "that", "the" }
try:
s = input()
except EOFError:
break
for i in range(0,26):
t = cipher(s,i)
w = set(t.split())
if len(w & wordset ) > 0:
print(t)
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,556
|
s467219555
|
p00017
|
u548252256
|
1562172685
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5568
| 286
|
if __name__ == '__main__':
A = "abcdefghijklmnopqrstuvwxyz"
while True:
try:
line = input()
for d in range(1,27):
t = line.translate(str.maketrans(A,A[d:] + A[:d]))
if 'the' in t or 'this' in t or 'that' in t:
print(t)
break
except EOFError:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,557
|
s882516830
|
p00017
|
u371539389
|
1560615249
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5560
| 500
|
while True:
try:
strings=input()
for i in range(26):
_strings=""
for s in strings:
if ord('a')<=ord(s) and ord(s)<=ord('z'):
_strings+=chr((ord(s)-ord('a')+1)%26+ord('a'))
else:
_strings+=s
strings=_strings
if "the" in strings or "this" in strings or "that" in strings:
print(strings)
break
except EOFError:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,558
|
s243604969
|
p00017
|
u506537276
|
1560157695
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5564
| 478
|
letters = ['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']
while True:
try:
s = input()
except:
break
l = len(s)
for i in range(26):
t = ""
for j in range(len(s)):
c = s[j]
if 'a' <= c and c <= 'z':
x = letters.index(c)
cc = letters[(x + i) % 26]
t += cc
else:
t += c
if ("the" in t) or ("this" in t) or ("that" in t):
print(t)
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,559
|
s461399297
|
p00017
|
u625806423
|
1557110018
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5556
| 594
|
while True:
try:
caesar = input()
except EOFError:
break
for i in range(26):
raw_letters = []
for j in range(len(caesar)):
if caesar[j] == " " or caesar[j] == ".":
raw_letters.append(caesar[j])
else:
letter = ord(caesar[j])+(i+1)
# 122 is ASCII 'z'
if letter > 122:
raw_letters.append(chr(letter-26))
else:
raw_letters.append(chr(letter))
raw_strings = "".join(raw_letters)
if ('the' in raw_strings) or ('this' in raw_strings) or ('that' in raw_strings):
print(raw_strings)
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,560
|
s411567997
|
p00017
|
u406093358
|
1555486505
|
Python
|
Python
|
py
|
Accepted
| 10
|
4692
| 922
|
import sys
def caesar(c, n):
cint = ord(c)
return chr((cint+n-97)%26+97)
keyword = ['the', 'this', 'that']
for line in sys.stdin:
slist = line.split()
indx = 1
while True:
decodelist = []
for i in range(0, len(slist)):
word = ''
for j in range(0, len(slist[i])):
if slist[i][j] == '.': word = word+'.'
else: word = word+caesar(slist[i][j], indx)
decodelist.append(word)
anotherlist = []
for i in range(0, len(decodelist)):
word = ''
for j in range(0, len(decodelist[i])):
if slist[i][j] == '.':
anotherlist.append(word)
word = ''
else: word = word + decodelist[i][j]
anotherlist.append(word)
flag = False
for i in range(0, 3):
if keyword[i] in decodelist or keyword[i] in anotherlist:
ans = decodelist[0]
for j in range(1, len(decodelist)):
ans = ans + ' ' + decodelist[j]
print ans
flag = True
break
if flag: break
indx += 1
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,561
|
s776585216
|
p00017
|
u350155409
|
1553160270
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5560
| 748
|
import sys
def get_shifted_char(shift_count, ch):
if ord(ch) >= ord('a') and ord(ch) <= ord('z'):
return chr(((ord(ch)-71-shift_count) %26 + 97))
else:
return ch
for enc_text in sys.stdin:
text_list = list(filter(lambda s:len(s)==3 or len(s)==4,enc_text.strip().split()))
shift_count = 1
while(shift_count < 27):
flg = False
for text in text_list:
decoded = ''.join(list(map(lambda c:get_shifted_char(shift_count,c),text)))
if decoded == "the" or decoded == "this" or decoded == "that":
flg = True
if flg:
break
shift_count += 1
print(''.join(list(map(lambda c:get_shifted_char(shift_count,c),enc_text.strip()))))
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,562
|
s906926649
|
p00017
|
u563075864
|
1542541098
|
Python
|
Python3
|
py
|
Accepted
| 40
|
6684
| 682
|
import string
while(1):
try:
text = input()
words = text.split()
stop = 0
for i in range(26):
if stop == 1:
break
a = []
b = []
for j in words:
a.append("".join([chr((ord(k) + i - ord("a")) % 26 + ord("a")) if ord(k) >= ord("a") else k for k in j]))
b.append("".join([chr((ord(k) + i - ord("a")) % 26 + ord("a")) for k in j if ord(k) >= ord("a")]))
for j in b:
if j in ["this","that","the"]:
print(" ".join(a))
stop = 1
break
except EOFError:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,563
|
s989491787
|
p00017
|
u067299340
|
1542172291
|
Python
|
Python3
|
py
|
Accepted
| 40
|
6500
| 360
|
import re
caesar_trans = str.maketrans("abcdefghijklmnopqrstuvwxyz", "zabcdefghijklmnopqrstuvwxy")
while True:
try:
i = input()
while True:
if re.search("(^| )(the|this|that)(\.| |$)", i) is not None:
print(i)
break
i = i.translate(caesar_trans)
except EOFError:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,564
|
s499310748
|
p00017
|
u717526540
|
1541651566
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5564
| 855
|
while(1):
try:
slist = list(map(str, input().split()))
except:
break
rot = 0
for i in range(26):
for s in slist:
ch = ""
for c in s:
if "a" <= c <= "z":
g = chr((ord(c) - ord("a") + i) % 26 + ord("a"))
else:
g = c
ch += g
if ch == "this" or ch == "that" or ch == "the":
rot = i
break
if rot != 0:
break
for i, s in enumerate(slist):
ch = ""
for c in s:
if "a" <= c <= "z":
g = chr((ord(c) - ord("a") + rot) % 26 + ord("a"))
else:
g = c
ch += g
if i == len(slist) - 1:
print(ch)
else:
print(ch + " ", end="")
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,565
|
s071009027
|
p00017
|
u219940997
|
1537452402
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5572
| 286
|
A = 'abcdefghijklmnopqrstuvwxyz'
while True:
try: s = input()
except: exit()
for x in range(1, 27):
ans = s[:-1].translate(str.maketrans(A, A[x:] + A[:x]))
if 'the' in ans or 'this' in ans or 'that' in ans:
print(ans + '.')
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,566
|
s249138797
|
p00017
|
u536280367
|
1537015738
|
Python
|
Python3
|
py
|
Accepted
| 40
|
6504
| 861
|
import re
def code_shift(c, n_shift):
return ord('a') + (ord(c) + n_shift - ord('a')) % 26
def get_candidate_plain(cipher, sym_ids, n_shift):
plain = []
for i, c in enumerate(cipher):
if i not in sym_ids:
plain.append(chr(code_shift(c, n_shift)))
else:
plain.append(c)
plain = ''.join(plain)
return plain
def decrypt(cipher):
sym_ids = [m.start() for m in re.finditer(r'[\.\n\s]', cipher)]
keyword = ['the', 'this', 'that']
n_shift = 0
while True:
plain = get_candidate_plain(cipher, sym_ids, n_shift)
for k in keyword:
if plain.find(k) != -1:
return plain
n_shift += 1
if __name__ == '__main__':
while True:
try:
cipher = input()
print(decrypt(cipher))
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,567
|
s872044700
|
p00017
|
u319725914
|
1534225680
|
Python
|
Python3
|
py
|
Accepted
| 30
|
5564
| 531
|
def rot_n(c, n):
if 'a' <= c and c <= 'z':
return chr((ord(c) - ord('a') + int(n)) % 26 + ord('a'))
if 'A' <= c and c <= 'Z':
return chr((ord(c) - ord('A') + int(n)) % 26 + ord('A'))
return c
def rot(s, n):
c = (rot_n(c, n) for c in s)
return "".join(c)
while(True):
try:
s = input()
for i in range(1,28):
d = rot(s,i)
if "this" in d.split() or "the" in d.split() or "that" in d.split():
print(d)
except:
break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,568
|
s941903079
|
p00017
|
u995990363
|
1533781330
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5568
| 700
|
import sys
idx2alpha = {idx:s for idx,s in enumerate('abcdefghijklmnopqrstuvwxyz .\n')}
alpha2idx = {s:idx for idx,s in enumerate('abcdefghijklmnopqrstuvwxyz .\n')}
def rotate(s):
idx = [next_w(alpha2idx.get(w)) for w in s]
new_s = [idx2alpha.get(i) for i in idx]
return ''.join(new_s)
def next_w(w_idx):
if 25 < w_idx:
return w_idx
w_idx += 1
return w_idx % 26
def decrypt(s):
for _ in range(26):
if 'the' in s or 'this' in s or 'that' in s:
return s
else:
s = rotate(s)
return 'Failed to decript!'
def run():
for line in sys.stdin:
print(decrypt(line.strip()))
if __name__ == '__main__':
run()
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,569
|
s342031384
|
p00017
|
u079141094
|
1467422457
|
Python
|
Python3
|
py
|
Accepted
| 30
|
7452
| 472
|
# Caesar Cipher
s = input()
while 1:
for diff in range(0,26):
dec = []
for c in s:
chn = ord(c)
if 97 <= chn < 97+26:
chn -= 97 + diff
chn = (chn % 26) + 97
dec.append(chr(chn))
else: dec.append(c)
ss = ''.join(dec)
if 'the' in ss or 'that' in ss or 'this' in ss:
print(ss)
break
try: s = input()
except EOFError: break
|
p00017
|
<H1>Caesar Cipher</H1>
<p>
In cryptography, Caesar cipher is one of the simplest and most widely known encryption method. Caesar cipher is a type of substitution cipher in which each letter in the text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, 'a' would be replaced by 'b', 'b' would become 'c', 'y' would become 'z', 'z' would become 'a', and so on. In that case, a text:
<pre>
this is a pen
</pre>
<p>
is would become:
</p>
<pre>
uijt jt b qfo
</pre>
<p>
Write a program which reads a text encrypted by Caesar Chipher and prints the corresponding decoded text. The number of shift is secret and it depends on datasets, but you can assume that the decoded text includes any of the following words: "the", "this", or "that".
</p>
<H2>Input</H2>
<p>
Input consists of several datasets. Each dataset consists of texts in a line. Input ends with EOF. The text consists of lower-case letters, periods, space, and end-of-lines. Only the letters have been encrypted. A line consists of at most 80 characters.
</p>
<p>
You may assume that you can create one decoded text which includes any of "the", "this", or "that" from the given input text.
</p>
<p>
The number of datasets is less than or equal to 20.
</p>
<H2>Output</H2>
<p>
Print decoded texts in a line.
</p>
<H2>Sample Input</H2>
<pre>
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
</pre>
<H2>Output for the Sample Input</H2>
<pre>
this is the picture that i took in the trip.
</pre>
|
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
|
this is the picture that i took in the trip.
| 6,570
|
s200929588
|
p00018
|
u231369830
|
1531118386
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5600
| 320
|
s = input()
s = s.split()
n = []
for i in s:
n.append(int(i))
isSorted = False
while(not isSorted):
isSorted = True
for i in range(4):
if n[i] < n[i + 1]:
temp = n[i]
n[i] = n[i + 1]
n[i + 1] = temp
isSorted = False
print(n[0],n[1],n[2],n[3],n[4])
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,571
|
s583977792
|
p00018
|
u525366883
|
1535540929
|
Python
|
Python
|
py
|
Accepted
| 10
|
4616
| 80
|
n = map(int, raw_input().split())
n.sort(reverse=True)
for i in n:
print i,
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,572
|
s475581543
|
p00018
|
u537067968
|
1551622107
|
Python
|
Python3
|
py
|
Accepted
| 20
|
5596
| 117
|
a = list(map(int, (input().split())))
a = sorted(a, reverse=True)
for i in range(4): print(a[i],end=' ')
print(a[4])
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,573
|
s432110158
|
p00018
|
u579833671
|
1410766287
|
Python
|
Python
|
py
|
Accepted
| 20
|
4192
| 103
|
n = map(int, raw_input().split())
n.sort(reverse = True)
for i in range(len(n)):
print(n[i]),
print
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,574
|
s371536619
|
p00018
|
u855866586
|
1412164412
|
Python
|
Python
|
py
|
Accepted
| 20
|
4184
| 144
|
while True:
try:
print "%d %d %d %d %d" % tuple(sorted(list(map(eval,raw_input().split())),reverse=True))
except EOFError: break
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,575
|
s545188574
|
p00018
|
u506132575
|
1416122832
|
Python
|
Python
|
py
|
Accepted
| 20
|
4184
| 158
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
for s in sys.stdin:
d = map(int , s.split())
d.sort()
d.reverse()
for e in d:
print e,
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,576
|
s651794634
|
p00018
|
u342537066
|
1420712214
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6724
| 146
|
lis=list(map(int,input().split()))
lis.sort()
for i in range(4,-1,-1):
if i!=4:
print(" ",end="")
print(lis[i],end="")
print("")
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,577
|
s149834408
|
p00018
|
u567380442
|
1422621079
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6724
| 53
|
print(*sorted(list(map(int, input().split())))[::-1])
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,578
|
s688417445
|
p00018
|
u879226672
|
1424276822
|
Python
|
Python
|
py
|
Accepted
| 20
|
4192
| 83
|
ls = map(int,raw_input().split())
ls.sort(reverse=True)
print " ".join(map(str,ls))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,579
|
s821318688
|
p00018
|
u540744789
|
1425804149
|
Python
|
Python
|
py
|
Accepted
| 20
|
4188
| 81
|
L=map(int,raw_input().split(" "))
print " ".join(map(str,sorted(L,reverse=True)))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,580
|
s492186456
|
p00018
|
u145563629
|
1428815116
|
Python
|
Python
|
py
|
Accepted
| 20
|
4200
| 148
|
def int_sort(num1, num2):
return cmp(int(num1), int(num2))
n = raw_input()
a = n.split()
a = sorted(a, cmp=int_sort)
a = a[::-1]
print " ".join(a)
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,581
|
s329629088
|
p00018
|
u162387221
|
1431327246
|
Python
|
Python
|
py
|
Accepted
| 20
|
4184
| 74
|
ls = sorted(map(int, raw_input().split()))
for i in ls[::-1]:
print i,
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,582
|
s782463471
|
p00018
|
u067299340
|
1433242451
|
Python
|
Python
|
py
|
Accepted
| 10
|
4184
| 60
|
for i in sorted(map(int,raw_input().split()))[::-1]:print i,
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,583
|
s937409685
|
p00018
|
u873482706
|
1434515269
|
Python
|
Python
|
py
|
Accepted
| 20
|
4196
| 243
|
import sys
for input_line in sys.stdin:
input_line = input_line.split()
input_line = [int(char) for char in input_line]
input_line.sort(reverse=True)
input_line = [str(num) for num in input_line]
print ' '.join(input_line)
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,584
|
s465526766
|
p00018
|
u379956761
|
1434878738
|
Python
|
Python3
|
py
|
Accepted
| 30
|
6724
| 189
|
import sys
a = input()
n = list(map(int, a.strip().split()))
n.sort()
n.reverse()
for i in range(len(n)):
print(n[i], end="")
if i < len(n)-1:
print(" ", end="")
print()
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,585
|
s027918335
|
p00018
|
u452212317
|
1436151179
|
Python
|
Python
|
py
|
Accepted
| 20
|
4192
| 127
|
x = map(int, raw_input().split())
x.sort()
x.reverse()
output = ''
for num in x:
output += str(num) + ' '
print output.strip()
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,586
|
s167173431
|
p00018
|
u140201022
|
1444539005
|
Python
|
Python
|
py
|
Accepted
| 10
|
6332
| 76
|
l=map(int,raw_input().split())
l.sort()
for i in l[::-1]:
print i,
print
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,587
|
s327958315
|
p00018
|
u775586391
|
1448331519
|
Python
|
Python3
|
py
|
Accepted
| 30
|
7736
| 95
|
l = [int(i) for i in input().split()]
l.sort()
l.reverse()
print(' '.join([str(i) for i in l]))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,588
|
s721059630
|
p00018
|
u461370825
|
1449741525
|
Python
|
Python
|
py
|
Accepted
| 10
|
6380
| 253
|
from math import *
PI = 3.1415926535898
while True:
try:
n = map(int, raw_input().strip().split(' '))
n.sort()
ans = ""
c = False
for x in reversed(n):
if c:
ans += ' '
c = True
ans += str(x)
print ans
except EOFError:
break
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,589
|
s858066147
|
p00018
|
u747479790
|
1449858242
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7660
| 74
|
print(' '.join(map(str, sorted(map(int, input().split()), reverse=True))))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,590
|
s239751949
|
p00018
|
u560214129
|
1450440464
|
Python
|
Python3
|
py
|
Accepted
| 30
|
7772
| 457
|
def sort(num):
l = len(num)
for i in range(0,l):
for j in range(0,l-i-1):
if num[j] < num[j+1]:
temp = num[j]
num[j] = num[j+1]
num[j+1]=temp
print(num[0],end='')
for i in range(1,len(num)-1):
print('',num[i],end='')
print('',num[i+1])
a , b , c , d , e = map(int,input().split())
num = []
num.append(a)
num.append(b)
num.append(c)
num.append(d)
num.append(e)
sort(num)
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,591
|
s237644109
|
p00018
|
u825618558
|
1451571814
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7584
| 246
|
import sys
line = sys.stdin.readline()
line = line.split(" ")
inp = []
for i in line:
inp.append(int(i))
inp.sort()
inp.reverse()
for i in range(len(inp)):
if i<len(inp)-1:
print (inp[i], end=" ")
else:
print (inp[i])
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,592
|
s404685197
|
p00018
|
u749493116
|
1452521718
|
Python
|
Python
|
py
|
Accepted
| 10
|
6428
| 134
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
a = map(int, raw_input().split(" "))
a.sort(reverse = True)
for val in a:
print val,
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,593
|
s897509354
|
p00018
|
u580607517
|
1453043271
|
Python
|
Python
|
py
|
Accepted
| 10
|
6428
| 105
|
l = [int(s) for s in raw_input().split()]
l = [str(s) for s in sorted(l, reverse=True)]
print ' '.join(l)
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,594
|
s255804954
|
p00018
|
u777299405
|
1453611638
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7644
| 55
|
print(*sorted(map(int, input().split()), reverse=True))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,595
|
s850538243
|
p00018
|
u512342660
|
1455473237
|
Python
|
Python
|
py
|
Accepted
| 10
|
6372
| 143
|
#! -*- coding:utf-8 -*-
nums = map(int, raw_input().split())
nums_sort = sorted(nums,reverse=True)
ans = " ".join(map(str,nums_sort))
print ans
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,596
|
s856866414
|
p00018
|
u797673668
|
1456637235
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7596
| 55
|
print(*sorted(map(int, input().split()), reverse=True))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,597
|
s444605304
|
p00018
|
u811773570
|
1458547505
|
Python
|
Python
|
py
|
Accepted
| 10
|
6308
| 94
|
#coding:utf-8
l = map(int, raw_input(). split())
l = sorted(l)
print l[4],l[3],l[2],l[1],l[0]
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,598
|
s395044634
|
p00018
|
u650459696
|
1458570782
|
Python
|
Python3
|
py
|
Accepted
| 20
|
7620
| 70
|
print(' '.join(map(str,sorted(list(map(int,input().split())))[::-1])))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,599
|
s051681325
|
p00018
|
u994049982
|
1458673575
|
Python
|
Python
|
py
|
Accepted
| 30
|
6376
| 77
|
a=sorted(map(int,raw_input().split()))[::-1]
print("%d %d %d %d %d"%tuple(a))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,600
|
s252403100
|
p00018
|
u811773570
|
1458711234
|
Python
|
Python
|
py
|
Accepted
| 10
|
6432
| 134
|
#coding:utf-8
l = map(int, raw_input(). split())
l = sorted(l, reverse=True)
print("%d %d %d %d %d" % (l[0], l[1], l[2], l[3], l[4]))
|
p00018
|
<H1>Sorting Five Numbers</H1>
<p>
Write a program which reads five numbers and sorts them in descending order.
</p>
<H2>Input</H2>
<p>
Input consists of five numbers <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var> and <var>e</var> (-100000 ≤ <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,<var>e</var> ≤ 100000). The five numbers are separeted by a space.
</p>
<H2>Output</H2>
<p>
Print the ordered numbers in a line. Adjacent numbers should be separated by a space.
</p>
<H2>Sample Input</H2>
<pre>
3 6 9 7 5
</pre>
<H2>Output for the Sample Input</H2>
<pre>
9 7 6 5 3
</pre>
|
3 6 9 7 5
|
9 7 6 5 3
| 6,601
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.