Lexicographical order is often known as alphabetical order when dealing with strings. A string is greater than another string if it comes later in a lexicographically sorted list.
Given a word, create a new word by swapping some or all of its characters. This new word must meet two criteria:
The next largest word is .
Complete the function biggerIsGreater below to create and return the new string meeting the criteria. If it is not possible, return no answer.
Complete the biggerIsGreater function in the editor below.
biggerIsGreater has the following parameter(s):
- string: the smallest lexicographically higher string possible or no answer
The first line of input contains , the number of test cases.
Each of the next lines contains .
Sample Input 0
Sample Output 0
Sample Input 1
Sample Output 1