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
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
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()
if len(S) <= K:
  print(S)
else:
  print(S[0:K]+"...")

Submission status: Accepted

Solution code:
S=lambda:input()
I=lambda:int(input())
L=lambda:list(map(int,input().split()))
LS=lambda:list(map(str,input().split()))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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


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

L = len(S)

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

Submission status: Accepted

Solution code:
import math,sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda:int(input())
li = lambda:list(map(int,input().split()))

def solve():
    k=I()
    a=input().strip()
    if(len(a)<=k):
        print(a)
    else:
        print(a[:k]+"...")
for _ in range(1):
    solve()

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

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

print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    k = I()
    s = S()
    if len(s) <= k:
        print(s)
    else:
        print(s[:k] + '...')

main()

Submission status: Accepted

Solution code:
k = int(input())

s = input()

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

Submission status: Accepted

Solution code:
import sys
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def main():
    k = int(stdin.readline().rstrip())
    s = str(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    if len(s) <= k:
        print(s)
    else:
        print(s[0:k] + "...")

main()

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

K = INT()
S = input()

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

Submission status: Accepted

Solution code:
import math
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    k=INT()
    s=STR()
    ls=len(s)
    if ls<=k:
        print(s)
    else:
        print(s[0:k]+'...')
if __name__ == '__main__':
    do()

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:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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 re
import math
from collections import defaultdict
from collections import deque
import itertools
from copy import deepcopy
import random
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
#@lru_cache(maxsize=None)
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_pow(a,b):#aはbの累乗数か
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def get_primes(n,type="int"):
    if n==0:
        if type=="int":return []
        else:return [False]
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=""):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def pm(x):
    return x//abs(x)
######################################################################################################
def main():
    K=int(input())
    S=input()
    if len(S)<=K:
        print(S)
    else:
        print(S[:K]+"...")
main()

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

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

Submission status: Accepted

Solution code:

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

print(ans)

Submission status: Accepted

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

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



if __name__ == "__main__":
    resolve()

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

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

Submission status: Accepted

Solution code:


from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

MOD = 10 ** 9 + 7
INF = 10 ** 18

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

Submission status: Accepted

Solution code:
def num():
    return int(input())


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

k = num()
s = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

k = ni()
s = ns()

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

Submission status: Accepted

Solution code:
def main():
    from sys import setrecursionlimit, stdin
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor, gcd
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**9+10

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

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

Submission status: Accepted

Solution code:
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

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 sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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],end="...")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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

Submission status: Accepted

Solution code:

import sys
sys.setrecursionlimit(10 ** 7)
# ----------

INF = float("inf")
MOD = 10 ** 9 + 7
# ----------

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

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

Submission status: Accepted

Solution code:
#from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


yes = "Yes"
no = "No"


def main():
    k = ii()
    s = input()
    if len(s) <= k:
        print(s)
    else:
        ans = s[:k]
        ans+='...'
        print(ans)








main()

Submission status: Accepted

Solution code:
# int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
# [int(i) for i in input().split()] # 配列で数字
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()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
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:
        print(S[:K] + '...')
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()
ls = len(s)
if ls<=k:
    print(s)
else:
    print(s[:k]+'...')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, d=DVSR): return pow(x, d - 2, d)
def DIV(x, y, d=DVSR): return (x * INV(y, d)) % d
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())


K=II()
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:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    K = int(input())
    S = input()[:-1]

    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:
    print(s)
else:
    print("".join(list(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:
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

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

    return

if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
k = int(input())
s = list(input().rstrip())
n = len(s)

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

Submission status: Accepted

Solution code:
lim = int(input())
string = input()

if len(string) <= lim:
    print(string)
else:
    print(string[:lim] + '...')

Submission status: Accepted

Solution code:
import sys

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

""" Input
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
A = np.array(input().split(), dtype=np.float64)
D = [int(input()) for _ in range(N)]
AB = [[int(x) for x in input().split()] for _ in range(N)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
"""

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

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

Submission status: Accepted

Solution code:

k = int(input())

s = input() #sys.stdin.readlineは最後が改行

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

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
import bisect
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return x if y == 0 else gcd(y, x%y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

K = I()
S = input()

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

Submission status: Accepted

Solution code:
mod = 10**9+7
import sys
import math
from collections import Counter, defaultdict, deque
from itertools import product, permutations, combinations, combinations_with_replacement
from itertools import accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from math import ceil,floor
from copy import deepcopy
from heapq import heappop,heappush,heapify
import heapq


# def combinations(n, r):
# 	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# def gcd(a, b):
# 	if b == 0:
# 		return a
# 	else:
# 		return gcd(b, a%b)
 
# def lcm(a, b):
# 	return a // gcd(a, b) * b

# l = ['a', 'a', 'a', 'a', 'b', 'c', 'c']
# c = Counter(l)

# d = defaultdict(int)

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

# リストの要素を改行を挟んで表示する
p2D = lambda x: print(*x, sep="\n")
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
# def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI(): return list(map(lambda x:int(x), sys.stdin.readline().split()))
def HI(): return list(map(lambda x:int(x)*(-1), sys.stdin.readline().split()))


K = II()
S = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
K = int(input())
Ss = input().rstrip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 0や1のケースに注意
# index out of range
# 貪欲

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    #mod = 10**9 + 7

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

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

Submission status: Accepted

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

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()


def solve():
    K = ni()
    S = ns()
    if len(S) > K:
        print(S[:K] + "...")
    else:
        print(S)


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

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