Mr IDC and his Message - Editorial

Practice

Contest

Author: Rahul Johari

Tester: Rahul Johari

DIFFICULTY:

CAKEWALK

PREREQUISITES:

String handling, typecasting

PROBLEM:

Mr.IDC wants to send letter to his girlfriend but the problem is he has encrypted the letter and his girlfriend doesn’t know how to decrypt. So she needs your help in decrypting the letter using a key K given as input.

EXPLANATION:

Mr.IDC has replaced each character with a new character (Ci - K) mod 26 where ( i = [ 0,|message| ] ).
So you just have to do:

l = len(s)
	ans = []
	for i in range(l):
		ans.append((ord(s[i])-97+k)%26)

You will get the final string which is the output.

AUTHOR’S AND TESTER’S SOLUTIONS:

Solutions can be found here.