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:
import sys
# from random import choice,randint
# from bisect import bisect_left as bl             
# from bisect import bisect_right as br  
# from collections import deque,defaultdict,Counter
# from math import sqrt,floor,ceil
# from itertools import combinations,permutations
# from heapq import heapify,heappop,heappush,heappushpop
# inp=sys.stdin.readline
# out=sys.stdout.write
# flsh=sys.stdout.flush
# ranomd string generator --> a = ''.join(random.choices(string.ascii_lowercase, k = 1000))
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod1=998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

#fact=[1]
#for i in range(1,100001):
#    fact.append((fact[-1]*i)%mod)
#ifact=[0]*100001
#ifact[100000]=pow(fact[100000],mod-2,mod)
#for i in range(100000,0,-1):
#    ifact[i-1]=(i*ifact[i])%mod
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()] #use list comprehension for loops
def LF(): return [float(x) for x in inp().strip().split()] #use try and except for dictionaries
def LS(): return inp().strip().split() #declare local variables ... for functions assing them to variables
def I(): return int(inp().strip()) # before using example ... func = len for using len() funtcion
def F(): return float(inp().strip()) #sort dictionary after zipping
def S(): return inp().strip() #use map function for mapping list to a fuction
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a)) #use this for string concatenation
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)
def modinv(n,p):return pow(n,p-2,p)
def ncr(n,r,p):                      
    t=((fact[n])*((ifact[r]*ifact[n-r])%p))%p
    return t

####################Actualcode################################
def main():
    k=I()
    s = S()
    if len(s)<=k:
        print(s)
    else:
        print(s[:k]+"...")


######## Python 2 and 3 footer by Pajenegod and c1729
py2 = round(0.5)
if py2:
    from future_builtins import ascii, filter, hex, map, oct, zip
    range = xrange

import os, sys
from io import IOBase, BytesIO

BUFSIZE = 8192
class FastIO(BytesIO):
    newlines = 0
    def __init__(self, file):
        self._file = file
        self._fd = file.fileno()
        self.writable = "x" in file.mode or "w" in file.mode
        self.write = super(FastIO, self).write if self.writable else None

    def _fill(self):
        s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
        self.seek((self.tell(), self.seek(0,2), super(FastIO, self).write(s))[0])
        return s
    def read(self):
        while self._fill(): pass
        return super(FastIO,self).read()

    def readline(self):
        while self.newlines == 0:
            s = self._fill(); self.newlines = s.count(b"\n") + (not s)
        self.newlines -= 1
        return super(FastIO, self).readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.getvalue())
            self.truncate(0), self.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        if py2:
            self.write = self.buffer.write
            self.read = self.buffer.read
            self.readline = self.buffer.readline
        else:
            self.write = lambda s:self.buffer.write(s.encode('ascii'))
            self.read = lambda:self.buffer.read().decode('ascii')
            self.readline = lambda:self.buffer.readline().decode('ascii')

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

inp = lambda: sys.stdin.readline().rstrip('\r\n')
out = lambda x: sys.stdout.write(x)
flsh= lambda: sys.stdout.flush()

if __name__ == "__main__":
    main()

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()
if K < len(S):
  print(S[0:K] + '...')
else:
  print(S)

Submission status: Accepted

Solution code:
# coding: utf-8
K = int(input())
S = input()

text = ""

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

Submission status: Accepted

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

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:
    ans = s[:k] + "..."
else:
    ans = s

print(ans)

Submission status: Accepted

Solution code:
def cin(): # To take limited number of inputs
	return map(int,input().split())

def cino(test=False): # To take individual int input (test = False)
    if not test:
        return int(input())
    else: # To take string input (test = True)
        return input()

def cina(): # array input
  return list(map(int,input().split()))

def ssplit(): # multiple string input
    return list(input().split())

def printlist(l): # to print space seperated array
    for i in l:
        print(i,end=" ")

def main():
    a = cino()
    b = cino(True)
    l = len(b)
    # print(len(b))
    if l<=a:
        print(b)
    else:
        print(b[:a]+"...")

if __name__=="__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

if len(S) > K:
    print(S[:K], "...", sep='')
else:
    print(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    k = int(input())
    s = input()
    if len(s) <= k:
        print(s)
    else:
        print(s[:k], end="")
        print("...")

resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
S = input()
temp = ""
if len(S) > K:
    for i in range(K):
        temp = temp + S[i]
    temp = temp + "..."
    print(temp)
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:
k = int(input())
s = input()

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

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:
#!/usr/bin/env python

def main():
    k = int(input())
    s = input()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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:
def main():
    K = int(input())
    S = input()
    l = len(S)
    if l <= K:
        print(S)
    else:
        print(S[0:K] + "...")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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:
#!/usr/bin/env python3
import sys
import collections

sys.setrecursionlimit(10 ** 7)

# 1 ✕ 1 (int)
K = int(input().rstrip())

# 1 ✕ 1 (str)
S = input().rstrip()

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

Submission status: Accepted

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

n = len(s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k = int(input())
list_n = input()
lis = [i for i in list_n]
if len(lis) <= k:
    print(list_n)
else:
    print("".join(lis[:k]) + "...")

Submission status: Accepted

Solution code:
def resolve():
    # 整数 1 つ
    k = int(input())
    s = input()
    # 整数複数個
    # a, b = map(int, input().split())
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

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



resolve()

Submission status: Accepted

Solution code:
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
k = int(input())
s = str(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:
    res = S
else:
    res = S[:K] + "..."

print(res)

Submission status: Accepted

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

K = int(input())
S = input().rstrip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

from pprint import pprint
from collections import deque, defaultdict
import itertools
import math
import sys

sys.setrecursionlimit(10 ** 6)
INF = float('inf')

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

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

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 = 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:
  ans = S[:K]
  ans_ = "."*3
  ans += ans_
  print(ans)

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()
suff = ''
if len(s) > k:
    suff = '...'
print(s[:k]+suff)

Submission status: Accepted

Solution code:
k = int(input())
s = input()
if len(s)<=k:
    print(s)
else:
    print(s[:k]+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)
else:
    print(s[:k] + '...')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k = int(input())
s = str(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)
else:
    print(f'{s[:k]}...')

Submission status: Accepted

Solution code:
k = int(input())
s = str(input())
if len(s) <= k:
    print(s)
else:
    for i in range(k):
        print(s[i],end="")
    print("...", end="")

Submission status: Accepted

Solution code:
k = int(input())
s = str(input())
#
#print(temp)##
mozi =""
if int(len(s)) <= k:
    print(s)
    exit()
else:
    for i in range(k):
            mozi = mozi + s[i]

mozi = mozi +"..."

print(mozi)

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools



sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]

#A, B = map(int,input().split())
K = int(input())
S = str(input())
s = len(S)

if(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)
        exit()

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


if __name__ == '__main__':
    main()

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=list(input())

nagasa=len(S)

if nagasa<=K:
    print(''.join(S))
else:
    ans=[]
    for n in range(K):
        ans.append(S[n])
    ans.append('...')
    print(''.join(ans))

Submission status: Accepted

Solution code:
K=int(input())
S=input()
s=list(S)
if len(s)<=K:
    print(S)
else:
    s=s[0:K]+['...']
    for i in s:
        print(i,end='')

Submission status: Accepted

Solution code:
b,= map(int, input().split())
a= input()
c= list(a)
if len(c)<=b:
  print(str(a))
else:
  print(str(a[:b])+"...")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    K = int(input())
    S = input()
    answer = ""
    if len(S) <= K:
        answer = S
    else:
        answer = S[:K] + "..."
    print(answer)

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()
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('{}{}'.format(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:
a=int(input())
b=input()
if len(b)<=a:
    print(b)
else:
    print(b[:a]+'...')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
S = str(input())
s = ''
if len(S) <= K:
  print(S)
else:
  S = list(S)
  for i in range(K):
    s += S[i]
  s += '...'  
  print(s)

Submission status: Accepted

Solution code:
import itertools

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

Len=len(S)

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

Submission status: Accepted

Solution code:
import sys

K = int(sys.stdin.readline().strip())
S = sys.stdin.readline().strip()

ans = ""
for i, char in enumerate(S):
    if i == K:
        ans += "..."
        break
    ans += char

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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


main()

Submission status: Accepted

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

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()
val = len(s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import numpy as np
from collections import Counter, defaultdict, deque

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def S():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


inf = float("inf")
mod = 10 ** 9 + 7

k = I()
s = S()

if len(s) <= k:
    print(s)
else:
    print(s[: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 :
    print(s)
else:
    print(s[0:k]+"...")

Submission status: Accepted

Solution code:
def main(K, S):
    if len(S) > K:
        answer = S[:K] + '...'
    else:
        answer = S
    print(answer)



if __name__ == '__main__':
    K = int(input())
    S = input()
    main(K, S)

Submission status: Accepted

Solution code:
def main():

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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:
def resolve():
    K = int(input())
    S = input()
    if len(S) <= K:
        print(S)
    else:
        newS = S[:K] + '...'
        print(newS)
resolve()

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 = list(input())
if k <len(s):
    print(f"{''.join(s[0:k])}...")
else:
    print(''.join(s))

Submission status: Accepted

Solution code:
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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[:K] + '...')
else:
    print(S)

Submission status: Accepted

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

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

Submission status: Accepted

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def b168(k, s):

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

def main():
    k = int(input())
    s = str(input())
    print(b168(k, s))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    K = int(input())
    S = input()
    if len(S) <= K:
        print(S)
    else:
        ans = S[:K] + '...'
        print(ans)
if __name__ == '__main__':
    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:
# -*- coding: 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:
    print(S)
else:
    S = list(S)
    for i in range(K):
        print(S[i], end='')
    print('...')

Submission status: Accepted

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

nagasa = len(S)

P = '...'

if nagasa <= K:
	print(S)
else:
	S = S[0:K]+P
	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:
k = int(input())
s = input()
S = len(s)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

lenS = len(S)

if lenS <= 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 = 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:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    K = INT()
    S = INPUT()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

lenS = len(S)

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

Submission status: Accepted

Solution code:
import numpy as np
import sys
import math

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

if len(S) <= 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:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
K = int(input())
S = list(input())[:-1]
n = len(S)
if n <= K:
    print("".join(S))
else:
    s = S[:K]+["..."]
    print("".join(s))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase

def readvars():
    k = map(int,input().split())
    return(k)

def readlist():
    li = list(map(int,input().split()))
    return(li)

def anslist(li):
    ans = " ".join([str(v) for v in li])
    return(ans)

def main():

	t = 1
#	t = int(input())

	for xx in range(t):
		k = int(input())
		s = input()
		li = len(s)
		if li <= k: print(s)
		else: print(s[:k]+"...")


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

if len(S) <= k:
    print(S)
else:
    print(S[:k], end = '')
    print('...')

Submission status: Accepted

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

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

Submission status: Accepted

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

mojisu = len(s)

ans = ''
if mojisu <= k:
    print(s)
else:
    for i in range(k):
        ans += s[i]
    ans += '...'
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

length = len(S)

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

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=list(input())
if len(S)<=K:
    print(*S,sep="")
else:
    kari=S[:K]
    kari.append("...")
    print(*kari,sep="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
  K = int(input())
  S = input()
  if len(S) <= K:
    print(S)
    return True
  print(S[:K]+"...")

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

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:
  ret = S
else:
  ret = S[:K] + '...'
  
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = s

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

print(ans)

Submission status: Accepted

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