Yash has a sequence of 26 distinct integers P = (P₁, P2, ..., P26)
consisting of integers from 1 to 26. He constructs a string
S following the below rule:
• For every i where (1 <=i<= 26), the i-th character of
S is the lowercase English letter at comes P₁-th in
alphabetical order.
Your task is to output the resultant string S
def yash(P):
ALPHABET = list('abcdefghijklmnopqrstuvwxyz')
S = ''
for i in P:
S += ALPHABET[i - 1]
return S
Comments
Leave a comment