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
## io ##
def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))
## dp ##
def DD2(d1,d2,init=0): return [[init]*d2 for _ in range(d1)]
def DD3(d1,d2,d3,init=0): return [DD2(d2,d3,init) for _ in range(d1)]
## math ##
def to_bin(x: int) -> str: return format(x,'b') # rev => int(res, 2)
def to_oct(x: int) -> str: return format(x,'o') # rev => int(res, 8)
def to_hex(x: int) -> str: return format(x,'x') # rev => int(res, 16)
def divc(x,y) -> int: return -(-x//y)
def divf(x,y) -> int: return x//y
def gcd(x,y):
    while y: x,y = y,x%y
    return x
def lcm(x,y): return x*y//gcd(x,y)
def enumerate_divs(n):
    """Return a tuple list of divisor of n"""
    return [(i,n//i) for i in range(1,int(n**0.5)+1) if n%i==0]
def get_primes(n=10**3):
    """Return a list of prime numbers n or less"""
    is_prime = [True]*(n+1)
    is_prime[0] = is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i*2, n+1, i): is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]
def prime_factor(n):
    """Return a list of prime factorization numbers of n"""
    res = []
    for i in range(2,int(n**0.5)+1):
        while n%i==0: res.append(i); n //= i
    if n != 1: res.append(n)
    return res
## const ##
MOD=10**9+7
## libs ##
import itertools as it
import functools as ft
from collections import deque, Counter
from heapq import heapify, heappop, heappush
from bisect import bisect_left
#======================================================#
def main():
    k = II()
    s = IS()
    n = len(s)
    if n > k:
        print(s[:k]+'...')
    else:
        print(s)

if __name__ == '__main__':
    main()

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:
num = int(input())
string = input()

if num < len(string):
    string = string[0:num] + '...'

print(string)

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 math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
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)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  k=I()
  s=S()

  n=len(s)
  if n<=k:
    return s
  return s[:k]+'...'

# main()
print(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 = input()

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

Submission status: Accepted

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

s = len(S)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
b = input()
i = 0
while i < a and i < len(b):
    print(end = b[i])
    i = i + 1
if a < len(b) :
    print(end = "...")

Submission status: Accepted

Solution code:

k = int(input())

s = input()

'''
k = 40
s = 'ferelibenterhominesidquodvoluntcredunt'
#s = "nikoandsolstice"
'''
nagasa = len(s)

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

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 len(s) <= k:
    print(s)
else:
    print(s[:k],'...',sep='')

Submission status: Accepted

Solution code:
K = int(input())
S = list(input())
S1 = []
L = len(S)

if(K >= L):
    print(''.join(S))
else :
    S.insert(K,'.')
    S.insert(K+1,'.')
    S.insert(K+2,'.')
    print(''.join(S[0:K+3]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
length = input()
length = int(length)

moji = input()
moji = str(moji)

if len(moji) <= length:
  print(moji)
else:
  print(moji[:length] + '...')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
S = input()
tail_str = ''
if K < len(S):
    tail_str = '...'
print('%s%s' % (S[:K], tail_str))

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 len(s) > k:
    s = s[:k]
    s.append("...")
print("".join(s))

Submission status: Accepted

Solution code:
K = int(input())
S = list(input())
len_S = int(len(S))
S1 = ' '

if len_S <= K:
  for x in S:
    S1 += x
  print(S1)
else:
  del S[K:]
  for x in S:
    S1 += x
  print(S1 + '...')

Submission status: Accepted

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


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

    s = s + "..."
    print(s)

Submission status: Accepted

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

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

Submission status: Accepted

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

if k < e:
  print(s[0:k]+'.'*3)
else:
  print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
s = input()
s = s.lower()
ls = []
if len(s) <= N:
    print(s)
else:
    c = s[:N] +"..."
    print(c)

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[0:K]+"...")

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

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

Submission status: Accepted

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

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

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 = input()
S = input()
ans =""
if len(str(S)) <= int(K):
    print(S)
else:
    for i in range(int(K)):
        ans += S[i]
    print(str(ans) + "...")

Submission status: Accepted

Solution code:
Kkk = int(input())  
String = str(input())
res=""
if len(String)>Kkk :
   for i in range (0,len(String)):
    if i<=Kkk-1:
      res=res+String[i]
   print(res+("..."))
else : 
  print(String)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    k = int(input())
    S = list(input())
    if len(S) <= k:
        print(''.join(S))
    else:
        print(f'{"".join(S[:k])}...')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

if l <= k:
    print(s)
else:
    print(f'{s[:k]}...')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
k=int(input())
s=list(input())
if len(s) > k:
  del s[k:]
  s.append('...')
  map = map(str, s)
  print(''.join(map))
else:
  map = map(str, s)
  print(''.join(map))

Submission status: Accepted

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

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

if s_len <= k:
    print(s)
else:
    i = 0
    s_list = list(s)
    result = []
    while i < k:
        result.append(s_list[i])
        i += 1
    print(''.join(result) + "...")

Submission status: Accepted

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

Submission status: Accepted

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

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[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:
n = int(input())
s = input()

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

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:
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:
import sys

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

if k < len(s):
  for i in range(k):
    sys.stdout.write(s[i])
  
  sys.stdout.write('...')
else:
  for i in range(len(s)):
    sys.stdout.write(s[i])

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:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    rr = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    rr = raw_input
rri = lambda: int(rr())
rrm = lambda: map(int, rr().split())

####
def solve(K,S):
    if len(S) <= K: return S
    return S[:K] + '...'
print solve(rri(), rr())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
K=int(input())
S=str(input())
import sys
s=''
for i in range(K):
    try:
        s+=S[i]
    except IndexError:
        print (s)
        sys.exit()
if s==S:
    print (s)
else:
    s=s+'...'
    print (s)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
#%%code
def resolve():
    K=int(input())
    S=input()
    s=len(S)
    if s>K:
        a=S[:K]
        print(a+"...")
    else:print(S)
#%%submit!
resolve()

Submission status: Accepted

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

Knum = int(K)
Slength = len(S)

if Slength <= Knum:
	str = S
else:
	str = S[0:Knum] + "..."

print(str)

Submission status: Accepted

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

ls = len(s)

if ls <= k:
    print(s)

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

Submission status: Accepted

Solution code:
def main():
  K = list(map(int,input().split()))[0]
  S = list(map(str,input().split()))[0]
  if K >= len(S):
    ans = S
  else:
    ans = S[0:K] + '...' 

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    k = II()
    s = list(S())
    if len(s) > k:
        print("".join(s[:k]) + "...")
    else:
        print("".join(s))
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = [input() for i in range(2)] 
s0 = int(s[0])
l0=len(s[1])
if s0 >= l0:
    print(s[1])
if s0 < l0:
    print(s[1][:s0]+'...')

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k=int(input())
s=input()
n=0
result=''
if len(s)<=k:
    print(s)
else:
    for i in s:
        result+=i
        k-=1
        if k==0:
            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:
#!/usr/bin/env python3

def solve(k: int, s: str) -> str:
    if len(s) <= k:
        return s
    else:
        return s[:k] + '...'

# generated by online-judge-template-generator v4.1.0 (https://github.com/kmyk/online-judge-template-generator)
def main():
    K = int(input())
    S = input()
    zzy = solve(K, S)
    print(zzy)

if __name__ == '__main__':
    main()

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:
# -*- coding: utf-8 -*-
import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたらFalse
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  # [1, 0, 3]

'''

def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''


########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    #lenを変数に置くと事故るから注意
    n=int(input())
    #a,b=input().split(" ")#a,bがともに文字列のとき
    #a,b=map(int, input().split(" "))
    #mapでとってもstrで変換すればappend可能
    #nl=list(map(int, input().split(" ")))#数字の時
    s=input()
    a=[i for i in s]#int取るとstrでも行ける
    #print(a)
    #brray=[list(map(int, input().split(" ")))for i in range(N)]
    #print(brray)


    for i in range(1,n+1,2):#これで1個飛ばしループになる
     pass
     #print(i)

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')#ある要素のインデックス番号を取得
    if len(s)>n:
     s = ''.join(a[:n])+'...'
     print(s)
     sys.exit()
    print(s)
    #s = " ".join(map(str,a))#スペースを空ける時はこう
    #print(s)
    # aaabbbccc

    #if state in known_states and not flag: # state => 2 steps => 5
        #こうやってある要素がリストの中にあるか探すのか
    #print(f'steps: {steps}, state: {state}')
    #こう書いてあるとデバックしやすい

    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

    ls = ["a", "b", "c", "d", "e"]


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

a = len(s)
if a <= 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(f'{S[:K]}...')

Submission status: Accepted

Solution code:
k=int(input())
s=input()
char=[]
if len(s) <= k:
    print(s)
elif len(s) > k:
    for i in range(k):
        char.append((s[i]))
    print(''.join(char) + "...")

Submission status: Accepted

Solution code:
a=int(input())
s=list(input())
if a>=len(s):
  for i in range(len(s)):
      print(s[i],end='')
else:
  del s[a:]
  s.append('...')
  for i in range(len(s)):
      print(s[i],end='')

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:
import sys
import os

k = int(input())
s = input()
s2 = s[:k]

if s == s2:
    print(s2)
else:
    print(s2 + "...")

sys.exit()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def main():
    k = int(si())
    s = si()[:-1]
    if len(s) > k:
        print(s[:k]+'...')
    else:
        print(s)

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:
K = input()
S = str(input())
if len(S)<=int(K):
    print(S)
if len(S)>int(K):
    K = int(K)
    S = str(S[0: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:
n=int(input())
a=input()
if len(a)<=n:
    print(a)
else:
    print(a[:n]+'...')

Submission status: Accepted

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

Submission status: Accepted

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

if K >= len(S):
    print(S)
    exit()

print("{}...".format(S[0:K]))

Submission status: Accepted

Solution code:
k = input()
s = input()
k = int(k)
s_len = len(s)
out = ''

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a = [(input()) for i in range(2)]

K = int(a[0])
S = a[1]

if 1 <= K <= 100 and 1 <= len(S) <= 100:
  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(f'{s[:k]}...')
else:
    print(s)

Submission status: Accepted

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

if K < len(S):
    print(S[0: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:
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:
K = int(input())
S = input()

if len(S) > K:

    for i in range(0,K):

        print(S[i], end="")

    print("...")

else:

    print(S)

Submission status: Accepted

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

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