Functionality to Implement:
You need to implement the function reverseShuffleMerge(s) which finds and returns the lexicographically smallest string that can be formed by rearranging the characters of input string s in such a way that the resulting string is half of the characters of s after a shuffle operation.
Input Requirements:
The function takes a single input parameter:
s (1 <= |s| <= 100): a string consisting of lowercase English letters.
Output Requirements:
The function must return a string which is the result of the rearrangement as specified.
Implementation Details:
Use collections from the collections module such as Counter and defaultdict to manage character counts and their positions.
Implement logic to track available and skipped characters while ensuring the resultant string is half of the original string length.
Ensure that characters are selected in a way that the final string is the smallest lexicographically possible.
File Requirements:
The solution must be written in a file located at /app/solution.py.
Example
Input:
python
reverseShuffleMerge("eggegg")
Output:
text
"egg"
Ensure to thoroughly test the function with various inputs to validate its correctness.