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: Wrong Answer

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: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    sys.setrecursionlimit(10**6)
    input = sys.stdin.readline
    K = int(input())
    S = input().strip()
    if len(S) <= K:
        print(S)
    else:
        print(S[:7]+'...')
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
import bisect
import numpy as np


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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

K = ii()
S = input()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

n=int(input())
st=input()
if n>=len(st):
    print(st)
else:
    print(st[0:n-1])

Submission status: Wrong Answer

Solution code:
import sys
#import time
#import copy
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def ri():
    return list(map(int, input().split()))
def rs():
    return list(input().strip())

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

Submission status: Wrong Answer

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    k = int(input())
    s = input()
    if len(s) >= k:
        print(s[:k] + '...')
    else:
        print(s)

if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    K=int(sys.stdin.readline())
    S=sys.stdin.readline()

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

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
def N(): return int(input())
def NM():return map(int,input().split())
def L():return list(NM())
def LN(n):return [N() for i in range(n)]
def LL(n):return [L() for i in range(n)]
def YesNo(x):print("Yes")if x==True else print("No")
k=N()
s=input()
if len(s)<=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:
    ans=[]
    for i in range(K):
        ans.append(S[i])
    print(''.join(ans)+'...')

Submission status: Accepted

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

if K < words:
    print(S[0:K] + "...")

else:
    print(S)

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


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    k = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    print(s if len(s) <= k else s[:k] + "...")


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

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

stdin = sys.stdin

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

K = ni()
S = ns()
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 = str(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[: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:
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

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

tmp = 0
res = 0

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

print(res)

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:
integer = int(input())
string = input()
if len(string) > integer:
    print(string[:integer] + '...')
else:
    print(string)

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

Submission status: Accepted

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

Submission status: Accepted

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