#310. 字符串递减截取拼接
字符串递减截取拼接
String Decreasing Substring Concatenation
Background
Congcong is currently learning about string processing. He encountered an interesting problem and needs your help to solve it.
Problem Description
Given a string and an integer , return a new string. This new string is formed by concatenating the first characters of , followed by the first characters of , then the first characters of , and so on, until the first character of . You may assume that is between and the length of the string , inclusive (i.e., ).
Input Format
Input is given from standard input in the following format.
A line containing a string . A line containing an integer .
Output Format
Output is printed to standard output in the following format.
A string, representing the concatenated result.
Sample
Chocolate
4
ChocChoChC
Chocolate
3
ChoChC
Ice Cream
2
IcI
Sample Explanation
Sample 1: The input string is "Chocolate\