Given a string and a number N, we need to mirror the characters from N-th position up to the length of the string in the alphabetical order. In mirror operation, we change ‘a’ to ‘z’, ‘b’ to ‘y’, and so on.
Input : N = 3 paradox Output : paizwlc We mirror characters from position 3 to end. Input : N = 6 pneumonia Output : pnefnlmrz
We have existing solution for this problem please refer Mirror characters of a string link. We can solve this problem in Python using Dictionary Data Structure. Mirror value of ‘a’ is ‘z’,’b’ is ‘y’ etc, so we create a dictionary data structure and one-to-one map reverse sequence of alphabets onto original sequence of alphabets. Now traverse characters from length k in given string and change characters into it’s mirror value using dictionary.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Mirror characters of a string
- Python | Convert string dictionary to dictionary
- Find largest word in dictionary by deleting some characters of given string
- Python | Convert flattened dictionary into nested dictionary
- Python | Convert nested dictionary into flattened dictionary
- Regular Dictionary vs Ordered Dictionary in Python
- Python - Update dictionary with other dictionary
- Python - Filter dictionary values in heterogenous dictionary
- Python - Replace dictionary value from other dictionary
- Python - Append Dictionary Keys and Values ( In order ) in dictionary
- Largest string obtained in Dictionary order after deleting K characters
- Check if the given string is the same as its reflection in a mirror
- Given a sorted dictionary of an alien language, find order of characters
- Python | Words extraction from set of characters using dictionary
- Combine similar characters in Python using Dictionary Get() Method
- Min flips of continuous characters to make all characters same in a string
- String with k distinct characters and no same characters adjacent
- Permutation of a string with maximum number of characters greater than its adjacent characters
- Rearrange the characters of the string such that no two adjacent characters are consecutive English alphabets
- Count of ungrouped characters after dividing a string into K groups of distinct characters