Problem2233--Maritozzo

2233: Maritozzo

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MB

Description

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 200200 points

Problem Statement

You are given three strings S_1, S_2, S_3S1,S2,S3 consisting of lowercase English letters, and a string TT consisting of 1, 2, 3.
Concatenate the three strings according to the characters in TT and print the resulting string. Formally, conform to the following instructions.
  • For each integer ii such that 1 \leq i \leq |T|1iT, let the string s_isi be defined as follows:
    • S_1S1, if the ii-th character of TT is 1;
    • S_2S2, if the ii-th character of TT is 2;
    • S_3S3, if the ii-th character of TT is 3.
  • Concatenate the strings s_1, s_2, \dots, s_{|T|}s1,s2,,sT in this order and print the resulting string.

Constraints

  • 1 \leq |S_1|, |S_2|, |S_3| \leq 101S1,S2,S310
  • 1 \leq |T| \leq 10001T1000
  • S_1S1S_2S2, and S_3S3 consist of lowercase English letters.
  • TT consists of 1, 2, and 3.

Input

Input is given from Standard Input in the following format:
S_1S1S_2S2S_3S3TT

Output

Print the answer.

Sample Input Copy

mari
to
zzo
1321

Sample Output Copy

marizzotomari

HINT

We have s_1 =s1= maris_2 =s2= zzos_3 =s3= tos_4 =s4= mari. Concatenate these and print the resulting string: marizzotomari.

Source/Category