Codesignal question - Practice

Hi guys,

I am not an expert at programming and just starting out and needed help on this easy question. I am trying to reflect a string.
This is the question:

Define an alphabet reflection as follows: a turns into z, b turns into y, c turns into x, ..., n turns into m, m turns into n, ..., z turns into a.

Define a string reflection as the result of applying the alphabet reflection to each of its characters.

Reflect the given string.

For inputString = "name", the output should be
solution(inputString) = "mznv".

How would you go about this? I tried writing a code in java and looped through the string and check using if statement if each character is a,b,c,d or e, etc. But that won't work.

image

Comments (2)