A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets ('a'-'z') and the ascii values will starts from 1 (i.e ascii value of 'a' is 1 and 'z' is 26). Now given a string S, you can perform operations, namely, add, delete and replace of any character present in the string. Every operation will consists of following costs
add = 2 unit
replace = 1 unit
delete = 3 unit
Your task is to convert the string to super ascii with the minimum cost. While converting the string to super ascii, the final string should contain the same characters as in the input string.
Comments
Leave a comment