Given a string str of lowercase alphabets only. The task is to replace every character by some new character. The new character belongs to (small case only) Replacement of str[i] is determined by:
str[i] = Character obtained after traversing ascii(str[i]) no. of characters in ‘a-z’ repeatedly after str[i].
Input: str = “geeksforgeeks”
In the above case str = “geeksforgeeks”,
the ASCII value of ‘g’ is 103 therefore ‘g’ has been replaced by moving 103 times from ‘g’ in the desired range i.e., a-z.
Hence, character ‘g’ is replaced by ‘f’.
Similarly, the complete string “geeksforgeeks” becomes “fbbnddvbfbbnd”.
Input: str = “science”
- Traverse the string.
- For every i, find the character that needs to be replaced with str[i].
- Replace str[i] with that character.
Below is the implementation of above approach:
- Find the missing value from the given equation a + b = c
- Check if lowercase and uppercase characters are in same order
- Count common subsequence in two strings
- Minimize the length of string by removing occurrence of only one character
- Minimum Cost to make two Numeric Strings Identical
- Program to find the product of ASCII values of characters in a string
- Minimum length of string having all permutation of given string.
- Rotations of a Binary String with Odd Value
- Check if a large number can be divided into two or more segments of equal sum
- Balance a string after removing extra brackets
- Minimum operation require to make first and last character same
- Program for assigning usernames using Trie
- Count strings with consonants and vowels at alternate position
- Convert a String to Integer Array in C/C++
- Check if a String can be converted to Pangram in K changes
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.