Maritozzo

AtCoder
IDabc219_b
Time2000ms
Memory256MB
Difficulty
You are given three strings $S_1, S_2, S_3$ consisting of lowercase English letters, and a string $T$ consisting of `1`, `2`, `3`. Concatenate the three strings according to the characters in $T$ and print the resulting string. Formally, conform to the following instructions. * For each integer $i$ such that $1 \leq i \leq |T|$, let the string $s_i$ be defined as follows: * $S_1$, if the $i$\-th character of $T$ is `1`; * $S_2$, if the $i$\-th character of $T$ is `2`; * $S_3$, if the $i$\-th character of $T$ is `3`. * Concatenate the strings $s_1, s_2, \dots, s_{|T|}$ in this order and print the resulting string. ## Constraints * $1 \leq |S_1|, |S_2|, |S_3| \leq 10$ * $1 \leq |T| \leq 1000$ * $S_1$, $S_2$, and $S_3$ consist of lowercase English letters. * $T$ consists of `1`, `2`, and `3`. ## Input Input is given from Standard Input in the following format: $S_1$ $S_2$ $S_3$ $T$ [samples]
Samples
Input #1
mari
to
zzo
1321
Output #1
marizzotomari

We have $s_1 = $ `mari`, $s_2 = $ `zzo`, $s_3 = $ `to`, $s_4 = $ `mari`. Concatenate these and print the resulting string: `marizzotomari`.
Input #2
abra
cad
abra
123
Output #2
abracadabra
Input #3
a
b
c
1
Output #3
a
API Response (JSON)
{
  "problem": {
    "name": "Maritozzo",
    "description": {
      "content": "You are given three strings $S_1, S_2, S_3$ consisting of lowercase English letters, and a string $T$ consisting of `1`, `2`, `3`. Concatenate the three strings according to the characters in $T$ and ",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "abc219_b"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You are given three strings $S_1, S_2, S_3$ consisting of lowercase English letters, and a string $T$ consisting of `1`, `2`, `3`.\nConcatenate the three strings according to the characters in $T$ and ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments