CPRMT  Common Permutation
Given two strings of lowercase letters, a and b, print the longest string x of lowercase letters such that there is a permutation of x that is a subsequence of a and there is a permutation of x that is a subsequence of b.
Input
Input file contains several lines of input. Consecutive two lines make a set of input. That means in the input file line 1 and 2 is a set of input, line 3 and 4 is a set of input and so on. The first line of a pair contains a and the second contains b. Each string is on a separate line and consists of at most 1000 lowercase letters.
Output
For each set of input, output a line containing x. If several x satisfy the criteria above, choose the first one in alphabetical order.
Example
Sample input: pretty women walking down the street Sample output: e nw et
hide comments
saurav52:
20170812 00:25:32
did it using DP :)


sandeep_4141:
20170614 18:25:17
too easy and straightforward !!! 

aditya9125:
20170417 20:22:36
Its easy ,just think simply. 

a2j007:
20170317 19:40:46


vengatesh15:
20170315 21:17:10
did in O(n).. 

epsilonalpha:
20170313 12:51:06
Why does DP approach fail here? I got a WA using DP but A/C using simple logic. 

vineetpratik:
20170309 19:06:46
too easy!! 

nilabja16180:
20170307 14:55:20
Easy but looks complicated! 

scorpion_ajay:
20170228 07:27:05
too easy....


hamjosh1:
20161118 11:33:28
simple adhoc 
Added by:  AndrĂ©s Leonardo Rojas Duarte 
Date:  20070805 
Time limit:  0.133s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ERL JSRHINO NODEJS PERL6 VB.NET 
Resource:  University of Alberta Local Contest 1999 