Greatest String
Practice
3.7 (24 votes)
Basic programming
Basics of implementation
Easy
Implementation
String manipulation
String manipulation
Problem
86% Success 6259 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

You are given a string S and an integer Q. You are allowed to perform at most Q operations on the string. In one operation, you can change any vowel to it's next character (e.g., 'a'->'b', 'e'->'f', 'i'->'j', 'o'->'p', 'u'->'v'). Generate the lexicographically greatest string by performing at most Q operations on string S.

Note- Vowels in English alphabet are- 'a','e','i','o','u'.

Input Format:

First line contains an integer T denoting the number of test cases .
For each test case,in first line you will be given the string S and in second line an integer Q (maximum number of operations allowed).  

Output Format:

For each test case , print the lexicographically greatest string that can be formed after applying at most Q operations on the given string.
Answer for each test case should come in a new line.

Constraints:

\(1 \le T \le 10\)

\(1 \le |S| \le 10^5\)

\(0 \le Q \le 10^5\)

String will consist of only lowercase English alphabets.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
71 votes
Tags:
Ad-HocApprovedEasyImplementationOpenReadySorting
Points:20
19 votes
Tags:
ArraysBasic ProgrammingEasyOpen
Points:20
11 votes
Tags:
Basic ProgrammingBasics of ImplementationEasyGrammar-VerifiedImplementationJavaOOPSOOPsPythonpython