String processing
You are given a dictionary that maps all lowercase English alphabets from
'a' to 'z' to either lor -1.
For a string of length k, you perform the below operation:
• Find the maximum character from index Ito k, and find the dictionary mapping of the respective maximum character.
• If dictionary mapping is 1, increment all characters from Ito k.
• 'a' becomes 'b', 'b' becomes 'c', . 'z' becomes 'a'.
Task
Determine the count of each lowercase English alphabet after N operations.
For Full Instructions and Note Please Use Those Images as reference... Please help
https://drive.google.com/file/d/1QVE-utPuKxxxah3P5T5geL93MX1G5vy_/view?usp=sharing
https://drive.google.com/file/d/1b3RT2IBIBMG2Ojob6uGqoDglXHg-Z928/view?usp=sharing
alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabetDict = dict()for char in alphabet:
alphabetDict[char] = 0
Comments
Leave a comment