CRYPT - EDITORIAL

Difficulty: Easy

Pre-requisites: String handling, string manipulation

Problem link:

Contest problem link

Practice problem link

Practice problem link

Problem:

Given a string, the task is to encrypt it using an algorithm that has been mentioned in the problem statement mentioned @ link.

Explanation:

The problem requires the input string to be manipulated in accordance to the algorithm mentioned in the problem statement.
The string is required to be manipulated in the following way :

  • Swap the two halves of the given string.

  • For each character x of the resultant string, find the position at which the character x appears in the English alphabet sequence, lets call it p.

  • The character x is to be replaced by (p%10).f((p/10)+1), where “.” is a concatenation operator and function f(n) returns the alphabet at position n.

Problem setter’s solution: SOLUTION