#ACSL1920J2. String Differences

String Differences

PROBLEM: ​Given 2 strings with all capital letters, eliminate characters using each of the rules below once until only different characters align. The rules are performed in the following order:

● Delete the second occurance of any double consonant. There will not be more than 2 of the same consonant together.

● Delete all vowels (A, E, I, O, U) unless the vowel is the first character in the string.

● Align the resulting strings from left to right. Then delete all like characters at like positions.

● Align the remaining characters from right to left. Then delete like characters at like positions starting from the end of the string.

Example:

MISSISSIPPI

MISSOURI

After removing the double consonants:

MISISIPI

MISOURI

After removing the vowels:

MSSP

MSR

After removing letters from L to R in same location:

SP

R

After removing letters from R to L in the same location (no changes):

SP

R

Output: R

INPUT

There will be 5​ inputs. Each input will contain 2 strings separated by a single space and each fewer than 80 characters.

OUTPUT

For each input, print the shorter of the two resulting strings or the first in alphabetical order if they have the same length. We guarantee that neither is an empty string.

SAMPLE INPUT

MISSISSIPPI MISSOURI
CATHERINE KATHERYNE
CONSTITUTIONAL CONVENTIONAL
COMPARTMENTALIZATION SEMIAUTOBIOGRAPHICAL
PHYSICIAN PHARMACY

SAMPLE OUTPUT

R
C
VN
SBGRPHCL
RMY