submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s880196761
p00017
Time Limit Exceeded
s = input() a = "".join([chr(97 + i) for i in range(26)]) b = "".join([a[i - 1] for i in range(26)]) x = str.maketrans(a, b) while True: s = s.translate(x) if "the." in s or "that." in s or "this." in s: print(s) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s998640371
p00017
Time Limit Exceeded
s = input() a = "".join([chr(97 + i) for i in range(26)]) b = "".join([a[i -1] for i in range(26)]) x = str.maketrans(a, b) while True: s.translate(x) if "the" in s or "that" in s or "this" in s: print(s) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s619878032
p00017
Time Limit Exceeded
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() while True: numcipher = [alp_num[val] for val in cipher] 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: continue except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s064868022
p00017
Time Limit Exceeded
alpha = list('abcdefghijklmnopqrstuvwxyza') def one_caesar(word): new_word = "" for s in word: if s == ".": new_word += "." continue new_word += alpha[alpha.index(s) + 1] return new_word while True: sentence = raw_input().split() while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence: for i in range(len(sentence)): sentence[i] = one_caesar(sentence[i]) print " ".join(sentence)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s554937447
p00017
Time Limit Exceeded
import string alpha = 'abcdefghijklmnopqrstuvwxyza' tbl = string.maketrans(alpha[:-1], alpha[1:]) while True: sentence = raw_input() while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence: sentence = sentence.translate(tbl) print sentence
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s288379182
p00017
Time Limit Exceeded
import string alpha = 'abcdefghijklmnopqrstuvwxyza' tbl = string.maketrans(alpha[:-1], alpha[1:]) while True: try: sentence = raw_input() while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence: sentence = sentence.translate(tbl) print sentence except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s504028561
p00017
Time Limit Exceeded
import string alpha = 'abcdefghijklmnopqrstuvwxyza' tbl = string.maketrans(alpha[:-1], alpha[1:]) while True: try: sentence = raw_input() while 'the' not in sentence or 'that' not in sentence or 'this' not in sentence: sentence = sentence.translate(tbl) print sentence except EOFError: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s872221987
p00017
Time Limit Exceeded
import string, sys alpha = 'abcdefghijklmnopqrstuvwxyza' tbl = string.maketrans(alpha[:-1], alpha[1:]) for s in sys.stdin: while 'the' not in s or 'that' not in s or 'this' not in s: s = s.translate(tbl) print s
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s859136077
p00017
Time Limit Exceeded
import sys, string alpha = 'abcdefghijklmnopqrstuvwxyza' t = string.maketrans(alpha[:-1], alpha[1:]) for s in sys.stdin: while not('the' in s or 'this' in s or 'than' in s): s = s.translate(t) print s
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s339352296
p00017
Time Limit Exceeded
import sys, string alpha = 'abcdefghijklmnopqrstuvwxyza' t = string.maketrans(alpha[:-1], alpha[1:]) for s in sys.stdin: while not('the' in s or 'this' in s or 'than' in s): s = s.translate(t) print s[:-1]
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s397044962
p00017
Time Limit Exceeded
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 'than' in s): s = s.translate(tbl) print s[:-1]
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s361354970
p00017
Accepted
try: while True: b = raw_input() import string t = string.maketrans("abcdefghijklmnopqrstuvwxyz","bcdefghijklmnopqrstuvwxyza") while not("this" in b or "the" in b or "that" in b): b = b.translate(t) print b except: pass
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s692201848
p00017
Accepted
import sys,string a = string.ascii_lowercase t = string.maketrans(a,a[1:]+a[0]) 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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s622642681
p00017
Accepted
import sys while True: try: input = raw_input() for i in range(0, 26): str = "" for c in input: if c.isalpha(): c = chr(ord(c) + i) if ord(c) > ord('z'): c = chr(ord('a') - ord('z') + ord(c) - 1) str += c for word in ["this", "that", "the"]: if (str.find(word) != -1): print str break except EOFError: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s877627081
p00017
Accepted
import string import sys alpha = string.ascii_lowercase for line in sys.stdin: for i in range(len(alpha)): cipher_str = "" for s in line: if s in alpha: cipher_str += alpha[(alpha.index(s)+i) % len(alpha)] else: cipher_str += s if "the" in cipher_str or "this" in cipher_str or "that" in cipher_str: print(cipher_str, end="") break else: print(line, end="")
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s448079878
p00017
Accepted
while(True): try: s = raw_input() for i in range(26): for j in range(len(s)): if('a' <= s[j] <= 'y'): s = s[0:j:] + chr(ord(s[j]) + 1) + s[j + 1::] elif(s[j] == 'z'): s = s[0:j:] + 'a' + s[j + 1::] if("this" in s or "that" in s or "the" in s): print(s) except Exception: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s741673909
p00017
Accepted
def mov(c,x): if ord('a')<=ord(c)<=ord('z'): return chr(ord('a')+(ord(c)-ord('a')+x)%26) else: return c while True: try: s=raw_input() flag=False for i in xrange(26): t=''.join([mov(c,i) for c in s]) #print t ts=t[:-1].split() if ('this' in ts) or ('that' in ts) or ('the' in ts ): flag=True break if flag: print t except EOFError: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s976531435
p00017
Accepted
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def move(i,string): lis = [] for e in string: if e == "." : lis.append(".") elif e == "\n": lis.append("\n") else: if ord(e)+i > 122: lis.append( chr(ord(e)+i-26) ) else: lis.append( chr(ord(e)+i ) ) st = "".join(lis) if st in ["the","that","this"]: return True else: return False def move2(i,string): lis = [] for e in string: if e == "." : lis.append(".") elif e == "\n": lis.append("") elif e == " ": lis.append(" ") else: if ord(e)+i > 122: lis.append( chr(ord(e)+i-26) ) else: lis.append( chr(ord(e)+i ) ) st = "".join(lis) return st for s in sys.stdin: flag = False i = 0 d = map(str , s.split()) for i in range(26): for e in d: if move(i,e): flag = True break if flag: break print move2(i,s)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s201085568
p00017
Accepted
import sys import string f = sys.stdin ceasar1 = str.maketrans(string.ascii_lowercase, string.ascii_lowercase[1:] + string.ascii_lowercase[:1]) for sentence in f: for i in range(len(string.ascii_lowercase)): sentence = sentence.translate(ceasar1) if 'the' in sentence or 'this' in sentence or 'that' in sentence: print(sentence, end='') break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s854964527
p00017
Accepted
import sys def c1(c): alph ="abcdefghijklmnopqrstuvwxyz" if c in alph: return alph[(alph.find(c)+1)%26] else: return c for string in sys.stdin: while True: af_string="" for c in string: af_string+=c1(c) if af_string.find("the")!=-1\ or af_string.find("this")!=-1\ or af_string.find("that")!=-1: break string = af_string print af_string[:-1]
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s167396469
p00017
Accepted
import sys alpha = 'abcdefghijklmnopqrstuvwxyz' def this(word): i=0 t=[] for c in word: x=ord(c)-ord('this'[i]) if x>=0: t.append(x) else: t.append(26+x) i+=1 if(t[0]==t[1] and t[1]==t[2] and t[2]==t[3]): return t[0] return 30 def that(word): i=0 t=[] for c in word: x=ord(c)-ord('that'[i]) if x>=0: t.append(x) else: t.append(26+x) i+=1 if(t[0]==t[1] and t[1]==t[2] and t[2]==t[3]): return t[0] return 30 def the(word): i=0 t=[] for c in word: x=ord(c)-ord('the'[i]) if x>=0: t.append(x) else: t.append(26+x) i+=1 if(t[0]==t[1] and t[1]==t[2]): return t[0] return 30 for string in sys.stdin: for word in string.split(" "): if(len(word)==3): if the(word) < 30: x=the(word) break if(len(word)==4): if this(word) <30: x=this(word) break if that(word) <30: x=that(word) break result="" for c in string: if c in alpha: result+=alpha[alpha.find(c)-x] else: result+=c print result[:-1]
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s378137526
p00017
Accepted
while True: try: s = raw_input() except EOFError: break for i in range(26): S = '' for c in s: if c.islower(): n = (ord(c)-ord('a')+i)%26 S +=chr(ord('a')+n) else: S += c if 'the' in S or 'this' in S or 'that' in S: print S break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s544916051
p00017
Accepted
import string def cipher(s, i): if s in string.ascii_lowercase: return string.ascii_lowercase[(ord(s) - ord('a')+ i) % 26] elif s in string.ascii_uppercase: return string.ascii_uppercase[(ord(s) - ord('A')+ i) % 26] else: return s def decode(s, i): return ''.join([cipher(x, i) for x in s]) while True: try: sent = input().split() except: break for i in range(26): si = [decode(s, i) for s in sent] if 'the' in si or 'this' in si or 'that' in si: print(' '.join(si))
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s724223827
p00017
Accepted
import sys c=lambda w,n:reduce(lambda a,b:a+b,[chr((ord(x)-97+n)%26+97)if x.isalpha() else x for x in w]) for i in sys.stdin: n=0 for s in i.replace(".","").split(): r=c(s,116-ord(s[0])) m=len(s) if m==3 and"the"==r or m==4 and r in["this","that"]:n=116-ord(s[0]) print c(i,n).replace("\n","")
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s897946889
p00017
Accepted
import sys,re c=lambda w,n:"".join([chr((ord(x)-97+n)%26+97)if x.isalpha()else x for x in w]) for i in sys.stdin: n=0 while not re.search("th(e|is|at)",c(i,n)):n+=1 print c(i,n).strip()
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s398089140
p00017
Accepted
import sys,re c=lambda l,n:re.sub("[a-z]",lambda x:chr((ord(x.group(0))-97+n)%26+97),l) for i in sys.stdin: n=0 while not re.search("th(e|is|at)",c(i,n)):n+=1 print c(i,n).strip()
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s381324328
p00017
Accepted
import sys,re c=lambda l,n:re.sub("\w",lambda x:chr((ord(x.group(0))-97+n)%26+97),l) for i in sys.stdin: n=0 while not re.search("th(e|is|at)",c(i,n)):n+=1 print c(i,n).strip()
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s611321244
p00017
Accepted
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys import math for s in sys.stdin: for i in range(26): state = list(s.strip()) j = 0 for d in state: if 'a' <= d and d <= 'z': state[j] = chr((ord(d) + i - ord('a')) % 26 + ord('a')) elif 'A' <= d and d <= 'Z': state[j] = chr((ord(d) + i - ord('A')) % 26 + ord('A')) j += 1 state = "".join(state) if "the" in state or "this" in state or "that" in state: print(state) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s253985652
p00017
Accepted
def sol(l): n=1 while n<27: ans=[] for i in l: x='' for j in i: s=ord(j)+n if s>=123: s-=26 if s<97: s=46 x+=chr(s) ans.append(x) if 'that' in ans or 'thet.' in ans or 'this' in ans or 'this.' in ans or 'the' in ans or 'the.' in ans: print ' '.join(ans) break n+=1 while 1: try: w=map(str,raw_input().split()) sol(w) except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s858346008
p00017
Accepted
from math import * PI = 3.1415926535898 x = "this" y = "the" z = "that" while True: try: s = str(raw_input()) res = "" ans = "" for i in range(26): res = "" for a in s: if a.isalpha(): c = chr(ord(a) + i) if ord(c) > ord('z'): c = chr(ord(c) - 26) elif ord(c) < ord('a'): c = chr(ord(c) + 26) res += c else: res += a if res.find(x) >= 0 or res.find(y) >= 0 or res.find(z) >= 0: ans = res print ans except EOFError: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s107432085
p00017
Accepted
import string import sys def check_exists(word_set, rotate_dict, search): for word in word_set: rotated_word = ''.join(rotate_dict[s] for s in word) if rotated_word == search: return True return False for line in sys.stdin: alphabets = string.ascii_lowercase frequency = [t[1] for t in sorted([(line.count(s), ord(s)) for s in alphabets], reverse=True)] freq_chr_offset = (4, 0, 19, 8, 14) ss = list(map(lambda word: word.strip('.\n'), line.split())) sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4) i, rotate_dict = 0, None for order in frequency: for offset in freq_chr_offset: i = 97 + offset - order rotate_dict = {a: b for a, b in zip(alphabets, alphabets[i:] + alphabets[:i])} if (check_exists(sl3, rotate_dict, 'the') + check_exists(sl4, rotate_dict, 'this') + check_exists(sl4, rotate_dict, 'that')) > 0: break else: continue break print(''.join(rotate_dict[s] if s.isalpha() else s for s in line), end='')
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s075178542
p00017
Accepted
base = ord('a') az = [chr(j) for j in range(base, base+26)] def crack(s): i = -1 while True: new = [] for c in s: if 96 < ord(c) < 123: new.append(az[(ord(c)-19+i)%26]) else: new.append(c) i -= 1 yield ''.join(new) while True: try: s = input() except: break c = crack(s) while True: ans = next(c) if 'the' in ans or 'this' in ans or 'that' in ans: print(ans) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s077831150
p00017
Accepted
import string import sys a = string.ascii_lowercase key = str.maketrans(a, a[1:] + a[:1]) for s in sys.stdin: for i in range(1, 27): s = s.translate(key) if 'the' in s or 'this' in s or 'that' in s: break print(s, end="")
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s883279492
p00017
Accepted
import string import sys a = string.ascii_lowercase key = str.maketrans(a, a[1:] + a[:1]) for s in sys.stdin: for i in range(26): s = s.translate(key) if 'the' in s or 'this' in s or 'that' in s: break print(s, end="")
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s636105769
p00017
Accepted
t = ord("t") z = ord("z") a = ord("a") def _decode(tv, v): spam = ord(v) if not (a <= spam <= z): return v x = t - ord(tv) y = spam + x if y > z: y = a + (y % z) - 1 elif y < a: y = z - (a - y - 1) return chr(y) while 1: try: txt = input() for s in [x for x in txt.split() if 3 <= len(x) <= 4]: tv = s[0] dec_val = ''.join(list(map(lambda x:_decode(tv,x),s))) if (dec_val in ('this', 'the', 'that')): print(''.join(list(map(lambda x:_decode(tv,x),txt)))) break except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s836214520
p00017
Accepted
while True: try: b = input() except: break if 'the' in b or 'this' in b or 'that' in b: print(b) for i in range(1,26): c = '' for j in b: if(j == 'z'): c += ('a') elif(str.isalpha(j) == 1): c += (chr(ord(j) + 1)) else: c += j if 'the' in c or 'this' in c or 'that' in c: print(c) break b = c
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s057624242
p00017
Accepted
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]
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s939313730
p00017
Accepted
# -*- coding: utf-8 -*- import sys import codecs for line in sys.stdin: for i in range(0, 26): ans = "" for j in range(len(line)): a = ord(line[j]) if ord('a') <= a <= ord('z'): if a-i >= ord('a'): ans = ans + chr(a-i) else: ans = ans + chr(a-i+26) else: ans = ans + line[j] if "the" in ans or "this" in ans or "that" in ans: break sys.stdout.write(ans)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s893238566
p00017
Accepted
import sys abc = 'abcdefghijklmnopqrstuvwxyz' lines = sys.stdin.readlines() for line in lines: for i in range(26): abcshift = abc[i:]+abc[:i] decode = line.translate(str.maketrans(abc, abcshift)) if 'the' in decode or 'this' in decode or 'that' in decode: print(decode, end = '') break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s926671345
p00017
Accepted
li = 'abcdefghijklmnopqrstuvwxyz' while True: try: s = input() except: exit() for d in range(1, 27): t = s[:-1].translate(str.maketrans(li, li[d:] + li[:d])) if 'the' in t or 'this' in t or 'that' in t: print(t + '.') break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s823787690
p00017
Accepted
#!/usr/bin/env python2 # coding: utf-8 def casar(s, n): d = {} for c in (65, 97): for i in range(26): d[chr(i+c)] = chr((i+n) % 26 + c) return "".join([d.get(c, c) for c in s]) while True: try: encrypttxt = raw_input() for i in range(26): t = casar(encrypttxt, i) if "the" in t or "this" in t or "that" in t: print t except EOFError: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s206496483
p00017
Accepted
#!/usr/bin/env python2 # coding: utf-8 def caesar(s, n): d = {} for c in (65, 97): for i in range(26): d[chr(i+c)] = chr((i+n) % 26 + c) return "".join([d.get(c, c) for c in s]) while True: try: encrypttxt = raw_input() for i in range(26): t = caesar(encrypttxt, i) if "the" in t or "this" in t or "that" in t: print t except EOFError: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s176973850
p00017
Accepted
chars = 'abcdefghijklmnopqrstuvwxyz' while True: try: string = input() except: exit() for i in range(1, 27): t = string.translate(string.maketrans(chars, chars[i:] + chars[:i])) if 'the' in t or 'this' in t or 'that' in t: print(t)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s574879754
p00017
Accepted
#!/usr/bin/env python import sys import re def move(char, num): if ord(char) + num <= ord('z'): return ord(char) + num else: return ord(char) + num - (ord('z') - ord('a') + 1) def shift(s, num): new = "" for i in range(0, len(s)): if s[i].isalpha(): new += str(chr(move(s[i], num))); else: new += s[i] return new def decrypt(s): for i in range(0, 26): decrypted = shift(s, i) if re.search('the|this|that', decrypted): return decrypted if __name__ == '__main__': lines = [] for line in sys.stdin: lines.append(line) for line in lines: print(decrypt(line), end="")
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s048090663
p00017
Accepted
import sys a = 'abcdefghijklmnopqrstuvwxyz' for i in sys.stdin.readlines(): s = i.strip() for j in range(1, 27): t = s.translate(str.maketrans(a, a[j:] + a[:j])) if 'the' in t or 'this' in t or 'that' in t: print(t)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s798742648
p00017
Accepted
def ceasar(sentence, n): sentence = list(sentence) for i in range(len(sentence)): if sentence[i] in alphabets: sentence[i] = alphabets[(alphabets.index(sentence[i]) + n) % 26] return ''.join(sentence) def is_right(sentence): words = '.'.join(sentence.split(' ')).split('.') return 'the' in words or 'this' in words or 'that' in words alphabets = 'abcdefghijklmnopqrstuvwxyz' while True: try: line = input() if line == '*': break except: break for i in range(26): if is_right(ceasar(line, i)): print(ceasar(line, i)) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s499081820
p00017
Accepted
l = [['the', 'uif', 'vjg', 'wkh', 'xli', 'ymj', 'znk', 'aol', 'bpm', 'cqn', 'dro', 'esp', 'ftq', 'gur', 'hvs', 'iwt', 'jxu', 'kyv', 'lzw', 'max', 'nby', 'ocz', 'pda', 'qeb', 'rfc', 'sgd'], \ ['this', 'uijt', 'vjku', 'wklv', 'xlmw', 'ymnx', 'znoy', 'aopz', 'bpqa', 'cqrb', 'drsc', 'estd', 'ftue', 'guvf', 'hvwg', 'iwxh', 'jxyi', 'kyzj', 'lzak', 'mabl', 'nbcm', 'ocdn', 'pdeo', 'qefp', 'rfgq', 'sghr'], \ ['that', 'uibu', 'vjcv', 'wkdw', 'xlex', 'ymfy', 'zngz', 'aoha', 'bpib', 'cqjc', 'drkd', 'esle', 'ftmf', 'gung', 'hvoh', 'iwpi', 'jxqj', 'kyrk', 'lzsl', 'matm', 'nbun', 'ocvo', 'pdwp', 'qexq', 'rfyr', 'sgzs']] while 1: try: s = raw_input() for w in l: for i in xrange(25): o = w[i] if s.find(w[i]) != -1: r = '' for c in s: if c == ' ' or c == '.' : r+= c else: r += chr((ord(c) - ord('a') - i) % 26 + ord('a')) print r break else: continue break except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s859157087
p00017
Accepted
import string def cyp(strr,n): nstrr='' for c in strr: if c in string.lowercase: ind=string.lowercase.index(c) nstrr+=string.lowercase[(ind+n)%26] else: nstrr+=c return nstrr while(1): try: s=raw_input() for i in range(26): nstrr=cyp(s,i) if ('the' in nstrr) or ('this' in nstrr) or ('that' in nstrr): print nstrr break except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s104713770
p00017
Accepted
import sys def decode(s, n): ret = '' for c in s: if c.isalpha(): ret += chr((ord(c)+n-ord('a'))%26+ord('a')) else: ret += c return ret T = ['the', 'this', 'that'] for line in sys.stdin: s = line.rstrip() for i in xrange(26): if any(t in decode(s, i) for t in T): print decode(s, i) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s039830540
p00017
Accepted
import sys s = "abcdefghijklmnopqrstuvwxyz" for line in sys.stdin: while True: if ("the" in line) or ("this" in line) or ("that" in line): break else: l = [i for i in line] for i in range(len(l)): if l[i] in s: a = s.index(l[i]) l[i] = l[i].replace(l[i],s[(a+1)%26]) line = "".join(l) print(line.rstrip())
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s726254741
p00017
Accepted
def cshift(w): r = "" for c in w: if c == 'z': r += 'a' elif c == '.': r += '.' else: r += chr(ord(c)+1) return r while True: try: sent = input() except EOFError: break words = sent.split() while ("the" not in words) and ("this" not in words) and ("that" not in words): for i, w in enumerate(words): words[i] = cshift(w) print(" ".join(words))
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s604357874
p00017
Accepted
import sys def decrypt(c, i): """ ????????¶????????? """ if c.isalpha(): t = ord(c) - i if t < ord('a'): t += 26 return chr(t) else: return c if __name__ == '__main__': # ??????????????\??? for line in sys.stdin: # ????????????????????? found = '' # ????????????????????? for i in range(0, 26): decrypted = ''.join([decrypt(x, i) for x in line.strip()]) # print(decrypted) if ' the ' in decrypted or ' this ' in decrypted or ' that ' in decrypted or \ decrypted.startswith('the ') or decrypted.startswith('this ') or decrypted.startswith('that '): found = decrypted break # ??????????????? if found: print(found)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s125617937
p00017
Accepted
def chg(s,n): res="" for i in s: o=ord(i) if 97<=o<=122: if o+n<=122: res+=chr(o+n) else: res+=chr(o+n-26) else: res+=i return res while True: try: s=input() for i in range(25,-1,-1): c=chg(s,i) e=c.split() if "the" in e or "this" in e or "that" in e: print(c) break except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s705697033
p00017
Accepted
def decode(s, n): a = "" for i in s: if i.islower(): o = ord(i) + n if o <= 122: a += chr(o) else: a += chr(o - 26) else: a += i return a def judge(s): a = s.split() return "the" in a or "this" in a or "that" in a while True: try: s = input() except: break for i in range(26): a = decode(s, i) if judge(a): print(a) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s361006116
p00017
Accepted
a='abcdefghijklmnopqrstuvwxyz' while 1: try:s=input() except:break for i in range(1,27): b='' for x in s: b+=a[a.index(x)-i]if x in a else x if 'the' in b or 'this' in b or 'that' in b:print(b);break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s827403717
p00017
Accepted
import sys def caesar(c): if c == "z": return "a" elif c == "Z": return "A" elif 65 <= ord(c) and ord(c) <= 122: return chr(ord(c)+1) else: return c while True: text = sys.stdin.readline() if not text: break text = text.rstrip() while True: if "the" in text or "this" in text or "that" in text: print(text) break text = "".join(map(caesar, list(text)))
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s682998046
p00017
Accepted
s = [] while True: try: s.append(input()) except: break for e in range(len(s)): st = list(map(str,s[e])) t = [] for c in st: t.append(ord(c)) for i in range(26): string = '' for j in range(len(st)): if t[j] >= 97 and 122 >= t[j]: l = 97 + ((t[j] - 97 + i) % 26) string += chr(l) else: string += chr(t[j]) if 'this' in string or 'the' in string or 'that' in string: print(string)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s774151820
p00017
Accepted
import re def rot(i,s): s0 = 'abcdefghijklmnopqrstuvwxyz' sr = s0[i:] + s0[:i] s1 = '' for i in range(len(s)): if s[i] in s0: s1 = s1 + sr[s0.find(s[i])] else: s1 = s1 + s[i] return(s1) def cae(s): for i in range(26): ro =rot(i,s) if re.search(r'the',ro) or re.search(r'this',ro) or re.search(r'that',ro): return(rot(i,s)) if __name__ == "__main__": while True: try: s = input() print(cae(s)) except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s650990395
p00017
Accepted
import sys def unzip(instd): for i in range(26): search = "" for idx in instd: if 97 <= ord(idx) <= 122: if ord(idx) + i <= 122: search += chr(ord(idx) + i) else: search += chr(ord(idx) + i - 26) else: search += idx if 'the' in search or 'this' in search or 'that' in search: return search for line in sys.stdin: print(unzip(line.rstrip()))
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s759557488
p00017
Accepted
while True: try: words=input() except: break for j in range(26): word="" for i in range(len(words)): if 65<=ord(words[i])<=90: if ord(words[i])+j>90: word+=chr(ord(word[i])+j-26) else: word+=chr(ord(word[i])+j) elif 97<=ord(words[i])<=122: if ord(words[i])+j>122: word+=chr(ord(words[i])+j-26) else: word+=chr(ord(words[i])+j) else: word+=words[i] if "the" in word or "this" in word or "that" in word: print(word)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s763729249
p00017
Accepted
import sys import math as mas li='abcdefghijklmnopqrstuvwxyz' for t in sys.stdin: for i in range(30): a=t[:-1].translate(str.maketrans(li,li[i:]+li[:i])) if 1+a.find("this") or 1+a.find("that") or 1+a.find("the"): print(a) break #for i in sys.stdin: # a,b=map(int,i.split()) # print(gcd(a,b),lcm(a,b))
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s994820077
p00017
Accepted
# -*- coding: utf-8 -*- import sys import os from math import sin, cos import math alphabet = 'abcdefghijklmnopqrstuvwxyz' def rotate_char(c, num): if c == ' ' or c == '.' or c == '\n': return c n = ord(c) + num if n > 122: n -= 26 return chr(n) def rotate_string(s, num): ret = [] for c in s: new_c = rotate_char(c, num) ret.append(new_c) return ''.join(ret) for s in sys.stdin: for i in range(26): rotated = rotate_string(s, i) if 'the' in rotated or 'this' in rotated or 'that' in rotated: print(rotated, end='') break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s732505932
p00017
Accepted
import sys alpha = 'abcdefghijklmnopqrstuvwxyz' for i in sys.stdin.readlines(): aaa = i.strip() for j in range(1, 27): text = aaa.translate(str.maketrans(alpha, alpha[j:] + alpha[:j])) if 'the' in text or 'this' in text or 'that' in text: print(text)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s616561350
p00017
Accepted
def c(s, n): s = list(s) for i in range(len(s)): if s[i] in alphabets: s[i] = alphabets[(alphabets.index(s[i]) + n) % 26] return ''.join(s) def is_right(s): words = '.'.join(s.split(' ')).split('.') return 'the' in words or 'this' in words or 'that' in words alphabets = 'abcdefghijklmnopqrstuvwxyz' while True: try: line = input() if line == '*': break except: break for i in range(26): if is_right(c(line, i)): print(c(line, i)) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s123944864
p00017
Accepted
from sys import stdin def ascii2num(ascii): return ord(ascii) - 96 def num2ascii(num): return chr(num + 96) def slide(word,num): return ''.join([num2ascii((ascii2num(ascii) - num) % 26 + 1) if ascii != '.' else '.' for ascii in word]) def includekeyword(words): for word in words: if word in keywords: return True return False keywords = ['the', 'this', 'that'] decode = [] for row in stdin: words = row.split() for num in range(1,27): tmp = [slide(word,num) for word in words] if includekeyword(tmp): decode = tmp print(' '.join(decode)) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s532197738
p00017
Accepted
import string a=string.ascii_lowercase while True: try: s=input() except: break for i in range(1, 27): t = s[:-1].translate(str.maketrans(a, a[i:]+a[:i])) if 'the'in t or'that'in t or'this'in t: print(t+".") break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s656993205
p00017
Accepted
while True: try: s = input() except: break for i in range(26): ss = "" for c in s: if c == ' ' or c == '.': ss += c continue c = ord(c) c = (c-ord('a')+i)%26+ord('a') ss += chr(c) a = ss.split() if "the" in a or "this" in a or "that" in a: print(ss) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s180003865
p00017
Accepted
def caesarshift(sentence): abc = "abcdefghijklmnopqrstuvwxyz" bcd = abc[1:] + "a" return sentence.translate(str.maketrans(abc, bcd)) while True: try: sentence = input() except EOFError: break while True: if "the" in sentence or "this" in sentence or "that" in sentence: break sentence = caesarshift(sentence) print(sentence)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s755092374
p00017
Accepted
import fileinput import string alphabetArray = list(string.ascii_lowercase) for data in fileinput.input(): for n in range(-26, 27): replacedStrAry = list(data.replace('\n', '').replace('\r', '')) for index in range(0, len(replacedStrAry)): if not replacedStrAry[index] in alphabetArray: continue if n >= 0: replacedStrAry[index] = alphabetArray[(alphabetArray.index(replacedStrAry[index]) + n) % 26] else: replacedStrAry[index] = replacedStrAry[index] = alphabetArray[alphabetArray.index(replacedStrAry[index]) + n] replacedStr = "".join(replacedStrAry) replacedStrSplitedBySpace = replacedStr.split(' ') if "the" in replacedStrSplitedBySpace or "this" in replacedStrSplitedBySpace or "that" in replacedStrSplitedBySpace: print(replacedStr) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s352815169
p00017
Accepted
import sys; for line in sys.stdin: if (line.find('the') != -1) | (line.find('this') != -1) | (line.find('that') != -1): print(line[0:len(line) - 1]); continue; alpha = 'abcdefghijklmnopqrstuvwxyz'; for i in range(1, 26): str = ''; for j in range(len(line) - 1): if ((line[j] == ' ') | (line[j] == '.')): str += line[j]; continue; index = alpha.find(line[j]); str += alpha[(index + i) % 26]; if (str.find('the') != -1) | (str.find('this') != -1) | (str.find('that') != -1): print(str); break;
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s817233332
p00017
Accepted
# Aizu Problem 0017: Caesar Cipher # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") def caesar_decrypt(N, cipher): text = "" for char in cipher: if 'a' <= char <= 'z': k = (ord(char) - 97 - N) % 26 text += chr(97 + k) else: text += char return text for cipher in sys.stdin: cipher = cipher.strip() for k in range(26): decrypted = caesar_decrypt(k, cipher) if "this" in decrypted or "the" in decrypted or "that" in decrypted: print(decrypted) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s812060603
p00017
Accepted
import string import sys def CaesarCipher(): low=string.ascii_lowercase for cry in sys.stdin: for i in range(1,27): dec=cry.translate(str.maketrans(low,low[i:]+low[:i])) if 'this' in dec or 'that' in dec or 'the' in dec: print(dec[:-1]) CaesarCipher()
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s924654498
p00017
Accepted
import sys for s in map(lambda l: list(l.rstrip()), sys.stdin.readlines()): while True: for i, c in enumerate(s): char_code = ord(c) if 97 <= char_code <= 122: char_code = char_code+1 if char_code < 122 else 97 s[i] = chr(char_code) _s = "".join(s) if "this" in _s or "the" in _s or "that" in _s: print(_s) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s848866819
p00017
Accepted
#!/usr/bin/env python2 # coding: utf-8 def caesar(s, n): d = {} for c in (65, 97): for i in range(26): d[chr(i+c)] = chr((i+n) % 26 + c) return "".join([d.get(c, c) for c in s]) while True: try: encrypt_txt = raw_input() except EOFError: break for i in range(26): t = caesar(encrypt_txt, i) if "the" in t or "this" in t or "that" in t: print t break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s937697325
p00017
Accepted
t = ord("t") z = ord("z") a = ord("a") def _decode(tv, v): spam = ord(v) if not (a <= spam <= z): return v x = t - ord(tv) y = spam + x if y > z: y = a + (y % z) - 1 elif y < a: y = z - (a - y - 1) return chr(y) while 1: try: txt = input() for s in [x for x in txt.split() if 3 <= len(x) <= 4]: tv = s[0] dec_val = ''.join(list(map(lambda x:_decode(tv,x),s))) if (dec_val in ('this', 'the', 'that')): print(''.join(list(map(lambda x:_decode(tv,x),txt)))) break except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s359059005
p00017
Accepted
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)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s519066331
p00017
Accepted
while True: try: s = input() except: break alphabet = 'abcdefghijklmnopqrstuvwxyz' for i in range(26): decoded_s = '' for j in range(len(s)): if s[j] not in alphabet: decoded_s += s[j] continue decoded_s += alphabet[alphabet.index(s[j]) - i] if 'the' in decoded_s or 'this' in decoded_s or 'that' in decoded_s: break print(decoded_s)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s817684434
p00017
Accepted
import sys for line in sys.stdin: if line == '\r' or line == '\n': break slist = list(line) slist.pop() while True: for i in range(len(slist)): if slist[i] == ' ' or slist[i] == '.' or slist[i] == ',': continue elif slist[i] == 'z': slist[i] = 'a' else: slist[i] = chr(ord(slist[i]) + 1) s = ''.join(slist) if "the" in s or "this" in s or "that" in s: print(s) break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s784881149
p00017
Accepted
while True: try: s = input() for i in range(27): ans = "" for j in range(len(s)): ch = s[j] if "a" <= ch <= "z": ans += chr((ord(ch) - ord("a") + i)%26 + ord("a")) else: ans += ch if "this" in ans or "that" in ans or"the" in ans: print(ans) break except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s729467133
p00017
Accepted
def ShiftCharacter(str): plaintext="" for ch in list(str): if 'a' <= ch <= 'z': plaintext += chr((ord(ch)-ord('a') + 1) % 26 + ord('a')) else: plaintext +=ch return plaintext def Match(str): fg = 0 if (str=="the") or (str=="this") or (str=="that"): fg = 1 return fg while True: try: flag =0 word=raw_input().split() if len(word)==0: break while (flag==0): #try: #print "aaaaa" for i in range(0,len(word)): word[i]=ShiftCharacter(word[i]) #print word[i] for j in range(0,len(word)): if Match(word[j]) == 1: flag = 1 break else: continue if flag==1: for k in range(0,len(word)-1): print word[k], print word[len(word)-1] except: break
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s850752291
p00017
Accepted
import math import re def get_input(): while True: try: yield ''.join(input()) except EOFError: break N = list(get_input()) for l in range(len(N)): S = list(N[l]) ans = "" for d in range(26): for i in range(len(S)): if ord('a') <= ord(S[i]) and ord(S[i]) < ord('z'): S[i] = chr(ord(S[i])+1) elif ord(S[i]) == ord('z'): S[i] = 'a' s = "".join(S) s = s.replace('.','') test = s.split() for i in range(len(test)): if test[i] == "the" or test[i] == "that" or test[i] == "this": ans = "".join(S) if ans != "": break print(ans)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s267610159
p00017
Accepted
import string strings = string.ascii_lowercase clues = [(19, 7, 8, 18), (19, 7, 0, 19), (19, 7, 4)] while True: try: data = input() except: break for word in data.split(): if len(word) == 4 or 3: dif = 19 - (ord(word[0]) - 97) enc = ["" for _ in range(26)] for k, v in zip([i for i in range(dif, dif+26)], strings): enc[k%26] = v candidate = tuple(enc.index(c) for c in word) try: clues.index(candidate) except: continue break ans = "" for c in data: try: ans += strings[enc.index(c)] except: ans = ans + "." if c == "." else ans + " " print(ans)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s206222110
p00017
Accepted
import sys a='abcdefghijklmnopqrstuvwxyz' for b in sys.stdin: b=b.strip() for i in range(26): c=''.join(a[ord(e)-97-i]if e in a else e for e in b) if any(('the'in c,'this'in c,'that'in c)):print(c)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s972498650
p00017
Accepted
import sys a='abcdefghijklmnopqrstuvwxyz' for b in sys.stdin: for i in range(26): c=''.join(a[ord(e)-97-i]if e in a else e for e in b) if any(('the'in c,'this'in c,'that'in c)):print(c.strip())
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s848536028
p00017
Accepted
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())
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s037582288
p00017
Accepted
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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s852476954
p00017
Accepted
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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s068761251
p00017
Accepted
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)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s022022118
p00017
Accepted
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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s993128699
p00017
Accepted
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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s962312919
p00017
Accepted
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)))
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s964147280
p00017
Accepted
# 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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s014836334
p00017
Accepted
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),
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s283108863
p00017
Accepted
#! /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()
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s048279021
p00017
Accepted
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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s591260824
p00017
Accepted
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)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s168287855
p00017
Accepted
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)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s734813000
p00017
Accepted
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)
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s465428567
p00017
Accepted
''' 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])
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>
s068156649
p00017
Accepted
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
xlmw mw xli tmgxyvi xlex m xsso mr xli xvmt.
this is the picture that i took in the trip.
<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>