#abc219b. B - Maritozzo

B - Maritozzo

Score : 200200 points

问题描述

你将得到三个由小写英文字母组成的字符串 S1,S2,S3S_1, S_2, S_3,以及一个由字符 1, 2, 3 组成的字符串 TT

根据 TT 中的字符顺序拼接这三个字符串,并输出结果字符串。具体规则如下:

  • 对于满足 1iT1 \leq i \leq |T| 的每个整数 ii,定义字符串 sis_i 如下:
    • TT 的第 ii 个字符为 1,则 si=S1s_i = S_1
    • TT 的第 ii 个字符为 2,则 si=S2s_i = S_2
    • TT 的第 ii 个字符为 3,则 si=S3s_i = S_3
  • 按照顺序拼接字符串 s1,s2,,sTs_1, s_2, \dots, s_{|T|} 并打印出最终得到的字符串。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given three strings S1,S2,S3S_1, S_2, S_3 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 1iT1 \leq i \leq |T|, let the string sis_i be defined as follows:
    • S1S_1, if the ii-th character of TT is 1;
    • S2S_2, if the ii-th character of TT is 2;
    • S3S_3, if the ii-th character of TT is 3.
  • Concatenate the strings s1,s2,,sTs_1, s_2, \dots, s_{|T|} in this order and print the resulting string.

Constraints

  • 1S1,S2,S3101 \leq |S_1|, |S_2|, |S_3| \leq 10
  • 1T10001 \leq |T| \leq 1000
  • S1S_1, S2S_2, and S3S_3 consist of lowercase English letters.
  • TT consists of 1, 2, and 3.

Input

Input is given from Standard Input in the following format:

S1S_1

S2S_2

S3S_3

TT

Output

Print the answer.

Sample Input 1

mari
to
zzo
1321

Sample Output 1

marizzotomari

We have s1=s_1 = mari, s2=s_2 = zzo, s3=s_3 = to, s4=s_4 = mari. Concatenate these and print the resulting string: marizzotomari.

Sample Input 2

abra
cad
abra
123

Sample Output 2

abracadabra

Sample Input 3

a
b
c
1

Sample Output 3

a

update @ 2024/3/10 09:40:32