Submit | All submissions | Best solutions | Back to list |
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
Added by: | Andrés Leonardo Rojas Duarte |
Date: | 2007-08-05 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 VB.NET |
Resource: | University of Alberta Local Contest 1999 |
hide comments
|
|||||
2017-03-09 19:06:46
too easy!! |
|||||
2017-03-07 14:55:20
Easy but looks complicated! |
|||||
2017-02-28 07:27:05
too easy.... 100!!!! balle balle ;) |
|||||
2016-11-18 11:33:28
simple adhoc |
|||||
2016-06-20 20:34:57
@codedog answer to that test case would be a blank line. |
|||||
2015-06-08 19:24:54 Rishabh Joshi
There is always at least one common letter. :) Problem setter, please always specify such details! |
|||||
2015-05-15 22:08:23 excursionist
Very easy !! Enjoyed ... xD |
|||||
2015-02-03 16:16:53 codedog
a b ans?? |
|||||
2010-04-03 06:15:41 :(){ :|: & };:
Do not use gets() in this task,it's better to write your own read_input function. Last edit: 2010-04-03 06:18:13 |