# Create an N-String

## Problem Statement

You have to create an N-string.

An N-string is a string created using two lists. The first list consists of strings. The second list consists of integer values. These two lists are of same length.

Each string from the first list has to be repeated for m-times where m is the respective integer value from the second list. The resulting string is the concatenation of all these repeated strings.

## Input

The first line of input consists of space separated string values.

The second line of input consists of space separated integer values.

## Output

Print the resulting N-string.

## As is

The boilerplate code is already there to read the input from user, in the `main()` function, and to print the value returned by the `createNString()` function. Do not edit this code.

## To do ✍

`createNString()` has two parameters: `words` and `counts`. Complete the function that creates and returns the N-string.

## Example 1

Test input

``````a b c d
1 8 2 6``````

Test output

``abbbbbbbbccdddddd``

Explanation

a is related for 1 time, b is repeated for 8 times, c is repeated for 2 times, and d is repeated for 6 times.

## Example 2

Test input

``````apple banana
3 1``````

Test output

``appleappleapplebanana``

## Python Program

``````# Complete the following function
def createNString(words, counts):
nstring = ""

return nstring

# Boilerplate code - Do not edit the following
def main():
words = input().split()
counts = [int(x) for x in input().split()]
print(createNString(words, counts))

if __name__ == "__main__":
main()``````

Input and Outputs 1

``````a b c
3 5 1``````
``aaabbbbbc``

Input and Outputs 2

``````apple red green
2 1 2``````
``appleappleredgreengreen``

Input and Outputs 3

``````a b c
0 5 1``````
``bbbbbc``

Input and Outputs 4

``````a b c
0 0 0``````
``````# Complete the following function
def createNString(words, counts):
nstring = ""
for word, count in zip(words, counts):
nstring += word * count
return nstring

# Boilerplate code - Do not edit the following
def main():
words = input().split()
counts = [int(x) for x in input().split()]
print(createNString(words, counts))

if __name__ == "__main__":
main()``````