Given a string S, we need to find reciprocal of it. The reciprocal of the letter is found by finding the difference between the position of the letter and first letter ‘A’. Then moving the same number of steps from letter ‘Z’. The character that we reach after above steps is reciprocal.
Reciprocal of Z is A and vice versa because if you reverse the position of the alphabet A will be in the position of Z.
Similarly, T is the reciprocal of G, J is the reciprocal of Q.
Input : PRAKHAR Output : KIZPSZI Input : VARUN Output : EZIFM
Just use a mathematical formula which gives the reciprocal of each character
Reciprocal(x) = ASCII(‘Z’) – ASCII(x) + ASCII(‘A’)
The ASCII value of Z and A will change according
to the uppercase and lowercase.
The reciprocal of Geeks for Geeks is - Tvvph uli Tvvph
- Put spaces between words starting with capital letters
- Length of the longest substring with no consecutive same letters
- Minimum number of letters needed to make a total of n
- Smallest Greater (than S) String of length K whose letters are subset of S
- Check if the string contains consecutive letters and each letter occurs exactly once
- Regex in Python to put spaces between words starting with capital letters
- Program to print last N lines | Set-2
- Program to print ASCII Value of a character
- Program to print all palindromes in a given range
- Program to print Step Pattern
- Program to print Even Odd Number Pyramid
- Program to print the initials of a name with the surname
- Program to print all substrings of a given string
- Write a program to print all permutations of a given string
- Java Program to print distinct permutations of a string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.