High School Programming League 2011/2012

String manipulation

Problem code: HS11STRM

You are given two strings: str1 and str2. For each successive letter from str2, remove its first occurrence in str1. Do nothing if a given letter from str2 does not exist in str1.

Input data specification

An integer t, 1<=t<=100, denoting the number of testcases, followed by t lines. Each line consists of two strings separated by a whitespace. Strings consist of lower-case letters from the Latin alphabet. The size of the whole test is limited by 1MB.

Output data specification

Output t strings, one string in each line according to the problem specification.

Example 1

Input:
7
whose shoe 
is the 
dirty shoe
please go 
out and 
wash your 
dirty shoe

Output:
w
is
dirty 
please 
out  
wash  
dirty 

Example 2

Input:
4
five potato
six potato
seven potato
more potato

Output:
five
six
seven
mre 

Scoring

By solving this problem you score 10 points.


Added by:Łukasz Kuszner
Date:2011-10-15
Time limit:1s
Source limit:50000B
Languages:All except: SED AWK ICK
Resource:High School Programming League
SPOJ System © 2010 Sphere Research Labs. All Rights Reserved.