Template Minimization
To search for words made up of Latin letters in a dictionary, a pattern is used where '?' stands for exactly one arbitrary character, and '*' stands for zero or more arbitrary characters. Some patterns are considered equivalent if they match the same set of words. For instance, the patterns "*??*a" and "?*?a" both match words with three or more letters ending in the letter 'a', but the second pattern is shorter.
Write a program to find the shortest pattern that is equivalent to the given one.
Input
The input file contains several patterns, each ranging from 1 to 50 characters in length. These patterns consist of Latin letters and the symbols '?' and '*'. Each pattern is provided on a separate line.
Output
For each pattern in the input file, print its minimal equivalent on the corresponding line in the output file. If there are multiple minimal equivalents, print the one that comes first in lexicographical order ('*' precedes '?' in the alphabet).