CONPAL Editorial

Problem

Converese Palindrome

Editorialist :

pdwivedi294

DIFFICULTY:

Simple

PREREQUISITES

None

Problem

As you are the aware of palindrome of a string. A string SS of length nn is said to be a palindrome if SiSi = Sn−i−1Sn−i−1 for every 0≤i<n0≤i<n.

Here the converse of lower case alphabets is defined as:

  • converse of a is z
  • converse of b is y
  • and so on… (converse of z is a).

A string SS of length nn is said to be converse palindrome if SiSi = converse (Sn−i−1Sn−i−1) for every 0≤i<n.

Note: The length of string is always even.

EXPLANATION

Idea is to traverse the string from the 0 to n/2 and check for every indices that it has the converse character at the index n-i-1.
converse of char “ch” will be :
char(‘z’ - char(ch -‘a’))