String Concatenation
Disha has three strings A, B, and C consisting of lowercase letters.She also has a string T consisting only of characters 1, 2 and 3.
She wants to concatenate the three strings according to the characters in T.
Your task is to print the final output string.
Note: Formally, follow the below instructions:
* For each integer i such that 1<=i<=|T|, let the string si be defined as follows:
*Concatenate the strings s1,s2,...,s|T| in this order and print the resulting string.
Sample Input1
mari
to
zzo
1321
Sample Output1
marizzotomari
The following set of codes should concatenate the strings provided:
# String concatenation
a = input()
b = input()
c = input()
T = input()
result = ''
# loop over each integer in T
for i in T:
if i == '1':
result += a
elif i == '2':
result += b
elif i == '3':
result += c
print(result)
Comments
Leave a comment