Problems > Cut and Dot

Cut and Dot

Difficulty: 800 2000 ms 128 MB

strings

If S is longer than K characters, keep the first K and append ...; otherwise print S unchanged.

Input: the first line has S; the second line has K.

Output: the possibly-truncated string.

Constraints:

  • 1 ≤ |S| ≤ 104
  • 1 ≤ K ≤ 104

Sample Tests

Input 1
hello
3
Output 1
hel...
Input 2
hi
5
Output 2
hi

Read the Editorial

Discussion (opens after you solve — no spoilers before)

No comments yet.

Submit Your Solution

Log in or create a free account to run and submit code.