#C11781. Constructing a Pattern String
Constructing a Pattern String
Constructing a Pattern String
You are given a string s and an integer n. Your task is to construct a pattern string by repeating the string s exactly n times. In each repetition, append a hyphen ('-') followed by the repetition number (starting from 1) immediately after the string s. The repetitions are concatenated together, forming a single output string.
For example, if s = abc and n = 3, the output should be abc-1abc-2abc-3.
The problem can be mathematically represented as follows: [ \text{Output} = \bigcup_{i=1}^{n} \Bigl( s ; \Vert ; -i \Bigr) ] where (\Vert) denotes string concatenation.
You need to implement the solution so that it reads input from the standard input (stdin) and outputs the result to the standard output (stdout).
inputFormat
The input consists of two lines. The first line contains the string s. The second line contains an integer n, representing the number of times the string s should be repeated. Note that s can be an empty string.
outputFormat
Output a single line containing the constructed pattern string as described.## sample
abc
3
abc-1abc-2abc-3