0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paizaラーニング問題集「【文字列 3】p4!2@」を解いてみた

Posted at

▼考え方

題意の通りコーディングしました。

▼コード

########## 処理0(準備) インプット ###########

S = input()

########## 処理1 Leet表現が含まれるか判定する処理 ###########

for i in range(len(S)):
    
    if S[i] == "p":
        
        if S[i:i+5] == "paiza":
            print("paiza")
            exit()

        elif (S[i+1] == "a" or S[i+1] == "4" or S[i+1] == "@") and\
             (S[i+2] == "i" or S[i+2] == "1" or S[i+2] == "!") and\
             (S[i+3] == "z" or S[i+3] == "2") and\
             (S[i+4] == "a" or S[i+4] == "4" or S[i+4] == "@"):
            print("leet")
            exit()

print("nothing")
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?