#280. 字符串首尾N字符拼接
字符串首尾N字符拼接
String First Last N Chars
Background
Dawei is studying string processing and encountered an interesting problem.
Problem Description
Given a string and an integer , return a new string made of the first characters and the last characters from the original string. The string length will be at least .
Input Format
Input is given from standard input in the following format.
A string . An integer .
Output Format
Output is printed to standard output in the following format.
A new string, formed by concatenating the first characters and the last characters of the original string.
Sample
Hello
2
Helo
Chocolate
3
Choate
Chocolate
1
Ce
Sample Explanation
For the first sample, the first 2 characters of "Hello" are "He\