#245. 字符串前缀重复拼接

    ID: 245 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatWarmup-2gesp3字符串循环结构

字符串前缀重复拼接

String Front Copies

Background

Congcong is currently learning about string manipulation. He encountered an interesting problem that requires copying a string's front multiple times.

Problem Description

Given a string ss and a non-negative integer nn, we define the "front" of the string as the first 3 characters. If the string's length is less than 3, the front is the string itself. Return nn copies of this front.

Input Format

Input is given from Standard Input in the following format.

ss nn

Output Format

Output is printed to Standard Output in the following format.

A string, representing nn copies of the front.

Sample

Chocolate
2
ChoCho
Chocolate
3
ChoChoCho
Abc
3
AbcAbcAbc

Sample Explanation

For the first sample, the string is "Chocolate\