Homer has two companions Alice and Bob. The two of them are string fans. At some point, Alice and Bob choose to play a game on a string s=s1s2… sn of length n comprising of lowercase English letters. They move in turns on the other hand and Alice takes the primary action. In a move, a player should
Correct answer will be upvoted else downvoted. Computer science.
Homer has two companions Alice and Bob. The two of them are string fans.
At some point, Alice and Bob choose to play a game on a string s=s1s2… sn of length n comprising of lowercase English letters. They move in turns on the other hand and Alice takes the primary action.
In a move, a player should pick a file I (1≤i≤n) that has not been picked previously, and change si to some other lowercase English letter c that c≠si.
At the point when all files have been picked, the game closures.
The objective of Alice is to make the last string lexicographically as little as could really be expected, while the objective of Bob is to make the last string lexicographically as extensive as could be expected. The two of them are down specialists, so they generally mess around ideally. Homer is certainly not a game master, so he thinks about what the last string will be.
A string an is lexicographically more modest than a string b if and provided that one of the accompanying holds:
a will be a prefix of b, however a≠b;
in the main position where an and b contrast, the string a has a letter that shows up prior in the letters in order than the comparing letter in b.
Input
Each test contains different experiments. The main line contains t (1≤t≤1000) — the number of experiments. Depiction of the experiments follows.
The main line of each experiment contains a solitary string s (1≤|s|≤50) comprising of lowercase English letters.
Output
For each experiment, print the last string in a solitary line.
Step by step
Solved in 4 steps with 1 images