Problem:


Score: 200 points

Problem Statement

We have a string S consisting of lowercase English letters.

If the length of S is at most K, print S without change.

If the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.

Constraints

K is an integer between 1 and 100 (inclusive).

S is a string consisting of lowercase English letters.

The length of S is between 1 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

K
S

Output

Print a string as stated in Problem Statement.

Sample Input 1

7
nikoandsolstice

Sample Output 1

nikoand...

nikoandsolstice has a length of 15, which exceeds K=7.

We should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....

Sample Input 2

40
ferelibenterhominesidquodvoluntcredunt

Sample Output 2

ferelibenterhominesidquodvoluntcredunt

The famous quote from Gaius Julius Caesar.



Sample input:
7
nikoandsolstice


Sample output:
nikoand...

Submission status: Accepted

Solution code:
# abc168_b.py
# https://atcoder.jp/contests/abc168/tasks/abc168_b

# B - ... (Triple Dots) /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点: 200点

# 問題文
# 英小文字からなる文字列 Sがあります。
# Sの長さが K 以下であれば、Sをそのまま出力してください。
# Sの長さが K を上回っているならば、先頭 K文字だけを切り出し、末尾に ... を付加して出力してください。

# 制約
#     Kは 1 以上 100以下の整数
#     Sは英小文字からなる文字列
#     Sの長さは 1 以上 100以下

# 入力
# 入力は以下の形式で標準入力から与えられる。
# K
# S

# 出力
# 問題文の通りに出力せよ。

# 入力例 1
# 7
# nikoandsolstice

# 出力例 1
# nikoand...

# nikoandsolstice の長さは 15であり、K=7を上回っています。
# この先頭 7文字を切り出して末尾に ... を付加した文字列 nikoand... を出力します。

# 入力例 2
# 40
# ferelibenterhominesidquodvoluntcredunt

# 出力例 2
# ferelibenterhominesidquodvoluntcredunt

# ガイウス・ユリウス・カエサルの名言です。


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    K = int(lines[0])
    S = lines[1]
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    if len(S) > K:
        result = S[:K] + '...'
    else:
        result = S

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['7', 'nikoandsolstice']
        lines_export = ['nikoand...']
    if pattern == 2:
        lines_input = ['40', 'ferelibenterhominesidquodvoluntcredunt']
        lines_export = ['ferelibenterhominesidquodvoluntcredunt']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
K = int(input())
S = input()

S_len = len(S)

if S_len <= K:
    print(S)
else:
    print(S[:K]+"...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k:
  print(s)
else:
  print(s[:k] + "...")

Submission status: Accepted

Solution code:
# 1
# 2 
# 3
K=int(input())
S=input()
if len(S)>K:
    print(S[:K]+'...')
else:
    print(S)

Submission status: Accepted

Solution code:
k = int(input())
s = str(input())

if len(s)>k:
  print(s[:k]+"...")
else:
  print(s[:k])

Submission status: Accepted

Solution code:
k = int(input())
s = input()
print(s if len(s) <= k else s[:k] + '...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[:K]+'...')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import itertools
import math
import sys

INF = float('inf')


def solve(K: int, S: str):
    return S[:K] + ['...', ''][len(S) <= K]


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    print(solve(K, S))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():

    K = int(input())
    S = input()
    if len(S) <= K:
        return S
    return S[:K] + '...'

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
    print(s)
else : 
    print(s[:k] + "...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[0:K] + '...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
#a, b = map(int, input().split())
#l = list(map(int, input().split()))
#s = input()


if len(s) <= k:
    print(s)
else:
    t = s[0:k] + "..."
    print(t)

Submission status: Accepted

Solution code:
k=int(input())
s=input()
if len(s)<=k:
    print(s)
else:
    print(s[:k:]+"...")

Submission status: Accepted

Solution code:
K=int(input())
S=input()
 
if len(S)<=K:
    print(S)
else:
    print(S[:K]+'...')

Submission status: Accepted

Solution code:
import sys
K = int(input())
S = input()

print(S) if len(S) <= K else print(S[:K]+"...")

Submission status: Accepted

Solution code:
import sys
K = int(input())
S = input()

if not ( 1 <= K <= 100 and isinstance(K,int) and S.islower() and 1 <= len(S) <= 100): sys.exit()

print(S) if len(S) <= K else print(S[:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = str(input())

if len(S) <=K:
    print(S)
else:
    print(S[:K] + '...')

Submission status: Accepted

Solution code:
K = int(input())
S = str(input())
if K >= len(S):
    print (S)
else:
    print (S[0:K]+ "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <=k:
  print(s)
else:
  print(s[0:k]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  print(s[:k], '...', sep='')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if (len(S) <= K):
  print(S)
else:
  print(S[0:K] + "...")

Submission status: Accepted

Solution code:
k=int(input())
s=input()
if k < len(s):
  s=s[:k]+"..."

print(s)

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if(k >= len(s)):
    print(s)
else:
    print(s[:k]+"...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()
t = len(s)

if t <= k:
    print(s)
else:
    print(s[:k]+"...")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k] + '...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
    print(s)
else:
    print(s[:k] + "...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if K < len(S):
    A = ""
    for i in range(K):
        A = str(A) + S[i]
    A = str(A) + "..."
    S = A
print(S)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else :
  print(S[0:K] + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k:
  print(s)
else:
  print(s[:k]+'...')

Submission status: Accepted

Solution code:
k,s=open(0)
k=int(k)
print(s[:k]+'...'*(len(s)-1>k))

Submission status: Accepted

Solution code:
k=int(input())
s=input()
print(s[:k]+"{0}".format("..."*(len(s)>k)))

Submission status: Accepted

Solution code:
k=int(input())
s=input()

if len(s) <= k:
  print(s)
else:
  print(s[:k] + '...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
S_list = list(S)

if K < len(S_list):
    print(S[:K] + "...")
else:
    print(S)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    K = int(input())
    S = input()

    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + "...")


def main():
    solve()


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
K = int(input())
S = input()

print(S[:K] + ('...' if len(S) > K else ''))

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
  ans = S
else:
  ans = S[0:K] + '...'

print(ans)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S)<=K:
  print(S)
else:
  print(S[:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if K >= len(S):
    print(S)
elif K < len(S):
    print(S[:K] + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) > k:
  print(s[0:k] + '...')
else:
  print(s)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

word = S
if len(S) > K:
    word =  S[:K] + "..."
print(word)

Submission status: Accepted

Solution code:
K=int(input())
S=input()
if len(S)<=K:
    print(S)
else:
   print(S[0:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()

n = len(S)
if n <= K:
    print(S)
else:
    print(S[0:K] + '...')

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())

if len(S) > N:
    print(S[:N] + '...')
else:
    print(S)

Submission status: Accepted

Solution code:
k = int(input())
s = input()
print(s if len(s)<=k else s[:k]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
print(s if len(s)<=k else s[:k]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) > k:
	print(s[:k]+'...')
else:
	print(s)

Submission status: Accepted

Solution code:
K, S=int(input()), input()

if len(S)<=K:
    print(S)
else:
    print(S[:K]+"...")

Submission status: Accepted

Solution code:
k = int(input())
s = list(input())

if len(s) <= k:
  print("".join(s[0:]))
else:
  print(str("".join(s[0:k])) + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()
a = len(s) - k
if a <= 0:
    print(s)
else:
    #a >0
    print(s[:k] + "...")

Submission status: Accepted

Solution code:
# abc168_b.py
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k] + '...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
print(S if len(S) <= K  else S[:K]+"..." )

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[:K] + "...")

Submission status: Accepted

Solution code:
# B Triple Dots

k = int(input())
s = input()

if len(s) <= k:
  print(s)
else:
  print(s[:k] + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    print(s[:k], end="...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if k >= len(s):
    print(s)
else:
    tmp = s[0:k]
    tmp = tmp + "..."
    print(tmp)

Submission status: Accepted

Solution code:
k = int(input())

s = input()

s = s if len(s) <= k else s[0:k] + '...'

print(s)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if K >= len(S):
  print(S)
else:
  print(S[:K] + "...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if K < len(S):
    S = S[:K] + "..."
print(S)

Submission status: Accepted

Solution code:
#import time

def main():
    K = int(input())
    S = input()
    if len(S) <= K:
        return S
    else:
        return S[:K] + "..."

if __name__ == '__main__':
    #start = time.time()
    print(main())
    #elapsed_time = time.time() - start
    #print("経過時間:{}".format(elapsed_time * 1000) + "[msec]")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

print(s if len(s) <= k else s[:k]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else:
  print(s[0:k] + "...")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
if len(s) > n:
  print(f'{s[:n]}...')
else:
  print(s)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
print(S if len(S) <= K else S[:K] + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s)<=k:
    print(s)
else:
    print(s[0:k] + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k:
  print(s)
else:
  print(s[0:k] + '...')

Submission status: Accepted

Solution code:
K=int(input())
S=(input())
if K>=len(S):
    print(S)
else:
    print(S[:K]+'...')

Submission status: Accepted

Solution code:
def TripleDots():

    Num = int(input())

    moji = str(input())

    if len(moji) > Num:
        moji_cut = moji[:Num] + '...'
        
    else:
        moji_cut = moji

    print(moji_cut)

if __name__ == '__main__':
    TripleDots()

Submission status: Accepted

Solution code:
N=int(input())
a=input()
i=0
he=""
if len(a)>N:
    for m in range(N):
        he=he+a[i]
        i=i+1
    he=he+"..."
    print(he)
else:
  print(a)

Submission status: Accepted

Solution code:
def main():
  k = int(input())
  s = input()
  if len(s) > k:
    print(s[:k]+str('...'))
  else:
    print(s)
 
    
    
if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if k >= len(s):
  print(s)
else:
  print(s[:k]+'...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
S_length = len(S)
if K >= S_length:
    print(S)
else:
    tmp = S[:K] + '...'
    print(tmp)

Submission status: Accepted

Solution code:
K=int(input())
S=str(input())
if len(S) <= K:
    print(S)
else:
    ans = S[0]
    for i in range(1,K):
        ans += S[i]
    ans += "..."
    print(ans)

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
    ans = s
else:
    ans = s[:k] + '...'
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()

if len(s) > n:
  print(s[:n] + '...')
else:
  print(s)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  S2 = S[:-(len(S) - K)] + "..."
  print(S2)

Submission status: Accepted

Solution code:
K,S=[input() for i in range(2)]
if len(S)<=int(K):
  print(S)
else:
  print(S[0:int(K)]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = str(input())

if len(S) <= K:
    print(S)
else:
    print(S[:K] + '...')

Submission status: Accepted

Solution code:
k=int(input())
s=input()
if len(s)<=k:
  print(s)
else:
  print(s[:k]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if k >= len(s):
  print(s)
else:
  print(s[:k] + '...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k:
    print(s)
elif len(s) > k:
    print(s[: k] + '...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if K>=len(S):
    print(S[0:K])
else:
    print(S[0:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) > K:
    for i in range(K):
        print(S[i],end="")
    print("...")
else:
    print(S)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

k=int(input())
s=input().rstrip()

print(s if len(s)<= k else s[:k]+'...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
ans = ""
if K >= len(S):
    print(S)
else:
    for i in range(K):
        ans += S[i]
    print(ans + "...")

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) > k:
  print(f'{s[:k]}...')
else:
  print(s)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
print(S[:K]+(K<len(S))*"...")

Submission status: Accepted

Solution code:
k = int(input())
s = str(input())

if len(s) <= k:
  print(s)
elif len(s) > k:
  print(s[:k] + '...')

Submission status: Accepted

Solution code:
k = int(input())
s = str(input())
if len(s) > k:
    print(s[:k] + "...")
else:
    print(s)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    str = ''
    for i in range(K):
        str += S[i]
    str += "..."
    print(str)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if K >= len(S):
    print(S)
else:
    print(S[0:K]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s)<=k:
    print(s)
if len(s)>k:
    print(s[:k]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k :
    print(s)
else :
    print(s[0:k]+"...")

Submission status: Accepted

Solution code:
K=int(input())
S=input()
l=[]

if len(S)<=K:
    print(S)
else:
    for i in range(K):
        l.append(S[i])
    print("".join(l)+'...')

Submission status: Accepted

Solution code:
def main():
    K = int(input())
    S = input().rstrip()
    if len(S) <= K:
        print(S)
    else:
        print(S[:K] + "...")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
k = int(input())
s = list(input())

l=[]
if(len(s)<=k):
  word = "".join(s)
  print(word)
else:
  for i in range(k):
    l.append(s[i])
    name = "".join(l)

  print(name + "...")

Submission status: Accepted

Solution code:
K = int(input())
s = input()
if len(s) <= K:
    print(s)
else:
    ans = s[:K] + '...'
    print(ans)

Submission status: Accepted

Solution code:
def main():
    k = int(input())
    s = input()
    if len(s) <= k:
        print(s)
    else:
        print(f"{s[:k]}...")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
K = int(input())
N = list(input())
#print(K,N)
ans = []
if len(N) > K:
	for i in range(len(N)-K):
		#print(i,len(N))
		N.pop(-1)
	N.append("...")
print("".join(N))

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S) > K:
    print(S[:K]+ "...")
else:
    print(S)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K:
  print(S)
else:
  print(S[:K]+"...")

Submission status: Accepted

Solution code:
import numpy as np
#import math
#from decimal import *
#from numba import njit

#@njit
def main():
    K = int(input())
    S = input()
    
    if len(S) <= K:
        print(S)
        return
    
    print(S[0:K]+'...')

main()

Submission status: Accepted

Solution code:
T=int(input())
S=str(input())
s=len(S)
if s<=T:
    print(S)
else:
    print(S[:T]+'...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) <= K: print(S)
else: print(S[:K]+'...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) > k:
    print("{}{}".format(s[:k], '...'))
else:
    print(s)

Submission status: Accepted

Solution code:
k = int(input())
s = list(input())
an_lis = []
if len(s) <= k:
    ans = "".join(s)
    print(ans)
else:
    for i in range(k):
        an_lis.append(s[i])
    an_lis.append("...")
    ans = "".join(an_lis)
    print(ans)

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) <= k:
  print(s)
else:
  print(s[:k] + "...")

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

K = I()
S = S()

if len(S) <= K:
    print(S)
else:
    print(S[0:K]+"...")

Submission status: Accepted

Solution code:
# -*- codinf: utf-8 -*-
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[0:K] + "...")

Submission status: Accepted

Solution code:

k = int(input())
s = input()

if len(s) <= k:
    ans = s
else:
    ans = s[:k] + "..."
print(ans)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
 
if len(S) <= K:
  print(S)
elif len(S) > K:
  print(S[0:K]+"...")

Submission status: Accepted

Solution code:
a=int(input())
b=input()
if a>=len(b):
  print(b)
else:
  print(b[0:a]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  S = S[0:K]
  print(S+'...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
result = S if len(S) <= K else S[:K] + "..."
print(result)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S) <= K :
    print(S)
else :
    print(S[:(K)] + "...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print("{0}...".format(S[0:K]))

Submission status: Accepted

Solution code:
K = int(input())#asking lenght of string wanted to be shorted
S = input()#asking string

if len(S)>K:##set that S must be greater than K
    print (S[:K], "...",sep="")# to print only the K number of the string
else:
    print (S)

Submission status: Accepted

Solution code:
k = int(input()) #input the K as integer 
s = input() #and S as a string


if len(s) <=k: #check lenght of s and compare it to k
    print(s)
else: print(s[0:k]+"...") #print the first k character

#time complexity O(k)

Submission status: Accepted

Solution code:
#input an interget
k=int(input())
#input an string
str1=str(input())
#get the length of the string
x=int(len(str1))
#initialise y
y=0
#make a second string for the appending
str2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if x<=k:
    print(str1)
#if not, delete the last character of the string
else:
    while y<k:
        print(str1[y],end=(""))
        y+=1
    print(str2)

Submission status: Accepted

Solution code:

k= int(input())
s= str(input())


if int(k)>=1 and int(k)<=100 and len(s)>=1 and len(s)<=100: #check if k and s are between 1 to 100

    if len(s) > k:

        print (s[:k]+"...") #cut the str until value of k and add ... to the end

    else:
        print (s)

Submission status: Accepted

Solution code:

while True:
     k = int(input())
     if 1 <= int(k) <= 100:
         break;
     print ('Error Invalid Input for K')
#Check constraint k

while True:
     s = input()
     if 1 <= len(s) <= 100:
         break;
     print ('Error Invalid Input for s')
#Check constraint s

if len(s) > k:
    print(s[:k] + "...")  #append
else:
    print(s)

Submission status: Accepted

Solution code:
#define S as string
#print S until len is equal to K
#time complexity O(1)

K = int(input())
S = input()

str = S

if len(S) > K:
    print (str[0:K]+ "...")
else:
    print(str)

Submission status: Accepted

Solution code:

K = int(input())
S = input()
if len(S) > K:
    print(S[:K] + "...")
else:
    print(S)

Submission status: Accepted

Solution code:
k=int(input()) #asking integer input
s=input() #asking string input

if len(s)>k:                
    print(s[:k]+"...")
else:
    print (s)

Submission status: Accepted

Solution code:
#K is an input for the range of S
#input to get lowercase the letters from users
K = int(input())
S = input()
if len (S) > K:
    print(S[:K] + "...")
else:
    print(S)

Submission status: Accepted

Solution code:
# Take both input K & S, then compare the length of S with K and assign it to length
# If the length is <= K print all
# And if length is >K print some of the character

K = int(input())
S = input()

x = 0

length = len(S)

if length <= K:
    print(S)
else:
    while x < K:
        print(S[x], end=(""))
        x += 1
    print("...")

Submission status: Accepted

Solution code:
K=int(input())
S=input()



if len(S) > K :
    print (S[0:K]+'...')

else:
    print(S)

Submission status: Accepted

Solution code:
num=int(input()) #ask integer for limitation
s=input() #ask string
if len(s) > num:    #check if the length s exceeded num
    print(s[:num] + "...")  #print s with the limit "num"
else:   #if the string not exceeded num
    print(s)

Submission status: Accepted

Solution code:
#K input for the range of S
K = int(input())
#input of lowercase english letters
S = input()
if len(S) > K:
    print(S[:K] + "...")
else:
    print(S)

Submission status: Accepted

Solution code:
k=int(input())
s=input()
if len(s) > k:
    print(s[:k] + "...")
else:
    print(s)
#get input k
#get input s
#if k is more than s
#print the characters before k
#if not print normally

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) > k:
    print(s[:k] + '...')
else:
    print(s)

Submission status: Accepted

Solution code:
k=int(input())
s=input()
if len(s) > k:
    print(s[:k] + "...")
else:
    print(s)

Submission status: Accepted

Solution code:
#input the K and S string
#using another new variable to count the length of string
#then compare the value with the string
#if string less than the value just pring the string S
#if the length of string more than the value
#cut the string using while loop then print ... at the end
#program end

K = int(input())  #O(1)
S = input() #O(1)
value=len(S)    #O(1)

if value <= K: 
    print(S)    #O(1)
elif value > K : 
    x=0     #O(1)
    while x<K: 
        print((S[x]),end=(""))  #O(1)
        x+=1
    print("...")   #O(1)

Submission status: Accepted

Solution code:
# Take the input K
# Take the inpus S

#Compare the length of S with K and put in in length
#If length<=K... print all
#If length>K... print some of the character

K = int(input()) # 0(1)
S = input() #0(1)
second_answer = [] #0(1)
x = 0 #0(1)

length = len(S) #0(1)

if length <= K : 
    print(S) #0(1)
else:
    while x<K : #0(K)
        print(S[x], end= (""))
        x += 1
    print("...")

Submission status: Accepted

Solution code:
n = int(input())
k=input()
if len(k)>n:
    print(k[:n]+'...')
else:
    print(k)

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if len(S) > K:
    S = S[:K] + '...'

print(S)

Submission status: Accepted

Solution code:
k = int(input())
s = input()

if len(s) > k:
    s = s[:k] + "..."

print(s)

Submission status: Accepted

Solution code:
def Ii():return int(input())
def Mi():return map(int,input().split())
def Li():return list(map(int,input().split()))
 
k = Ii()
a = input()
m = len(a)
if k >= m:
  print(a)
else:
  print(a[:k],end="")
  print('...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if(len(S) <= K):
  print(S)
else:
  print(S[0:K] + "...")

Submission status: Accepted

Solution code:
k = int (input())
s = input()
line = []

if (len(s) > k):
  for i in range(k):
    line.append(s[i])
  print (''.join(line) + "...")
else:
  print(s)

Submission status: Accepted

Solution code:
N = int(input())
s = input()

if len(s) > N:
  s = s[:N] + "..."
  
print(s)

Submission status: Accepted

Solution code:

K=int(input())
S=input()

if len(S)<=K:
    print(S)
else:
    print(S[:K]+'...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S)<=K: print(S)
else: print(S[:K]+'...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if(len(S) <= K):
    print(S)
else:
    for i in range(K):
        print(S[i], end="")
    print("...")

Submission status: Accepted

Solution code:
K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
S = str(input())
if  len(S) > K:
  print(S[:K]+'...')
else:
  print(S)

Submission status: Accepted

Solution code:
n = input()
n = int(n)
word = input()
if n >= len(word):
    print(word)
else:
    for i in range(n):
        print(word[i], end='')
    print('...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
  print(s)
else :
  print(s[:k] + '...')

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s) <= k:
  print(s)
elif len(s) > k:
  print((s[0:k] + '...'))

Submission status: Accepted

Solution code:
k = int(input())
s = input()
a = list(s.split())
if len(s) <= k:
  print(s)
elif len(s) > k:
  print((s[0:k] + '...'))

Submission status: Accepted

Solution code:
#create date: 2020-07-01 11:48

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    k = ni()
    s = ns()
    n = len(s)
    if n <= k:
        print(s)
    else:
        print(s[:k] + "...")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
print(s if len(s) <= n else s[:n] + '...')

Submission status: Accepted

Solution code:
K = int(input())
S = input()

if K < len(S):
    print(S[:K] + '...')
else:
    print(S)

Submission status: Accepted

Solution code:
K = int(input())
S = input()
l = len(S)
if l <= K:
  print(S)
else:
  print(S[:K]+"...")

Submission status: Accepted

Solution code:
K = int(input())
s = input()
ans = ''.join(list(s)[:K])
print(ans.ljust(K+3, '.') if s != ans else s)

Submission status: Accepted

Solution code:
def word():
    K = int(input())
    S = str(input())
    A = ""
    if len(S) <= K:
        print(S)
        return
    else:
        for i in range(K):
            A = A + S[i]
    A = A + "..."
    print(A)
    return
word()

Submission status: Accepted

Solution code:
a = int(input())
b = input()
if len(b) <= a:
  print(b)
else:
  print(b[:a]+'...')

Submission status: Accepted

Solution code:
k=int(input())
s=input()

if len(s)<=k:
    print(s)

else:
    print(s[:k]+'...')