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: Runtime Error

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

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

print(a)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
K = int(input())
S = input()
ls = list(S)
if len(S) >= K:
  ansl = ls[0:K-1]
print(''.join(ansl) + '...')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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


def solve(K: int, S: str):
    if (len(S) <= K):
        print(S)
    else:
        print(K[0:K+1], "...", sep='')
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(K, S)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if len(S) > K:
    # print(S[:K])
    a = S[:K]  + '...'
    # S = S[:K].append('...')

print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
I cant solve the problem.

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
date0=int(input())
date1=input()
date2=list(date1)
if len(date2)<=date0:
    print(date1)
else:
    for i in range(date0-1):
        print(date2[i],end="")
    print(date2[i+1]+"...")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if len(N)>7:
    print(M[0:7]+'...')
else:
    print(M)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from sys import stdin

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

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

Submission status: Runtime Error

Solution code:
import numpy as np
#, K = map(int, input().split())

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

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

Submission status: Runtime Error

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import numpy,math

n = int(input())
s = str(input())

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

Submission status: Runtime Error

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

if len(N)>7:
    print(M[0:7]+'...')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
k = int(input())
s = str(input())
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k+1], '...']])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#import numpy as np
#a,b,c=map(int,input().split())
z=int(input())
a=input()
if len(a)>z:
    b=a[:z]
    print(b+"...")
else:
    print(b)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
k = int(input())
s = input()
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k], '...']])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
k = int(input())
s = input()
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k+1], '...']])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
k = input()
s = int(input())
len_s = len(s)
 
if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k], '...']])

Submission status: Runtime Error

Solution code:
numTest = int(input())

inputLine = input()

print(inputLine[0 : numTest] + '...' if len(inputLine) > numTest else inputLine

Submission status: Runtime Error

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

if len_s <= k:
  print(s)
else:
  print(''.join([str(x) for x in [s[:k+1], '...']])

Submission status: Runtime Error

Solution code:
K = int(input())
S = input()
if len(S)<=K:
  print(S)
else:
  print(S[0]+S[1]+S[2]+S[3]+S[4]+S[5]+S[6]+"...")

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (ll i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (ll i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (ll i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (ll i = x.size()-1; i >= 0; i--)
#define REPITR(itr,x) for (auto itr = (x).begin(); itr != (x).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define debug(x) cerr<<__LINE__<<": "<<(#x)<<" = "<<(x)<<endl;
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define e1 first
#define e2 second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int main()
{
	int k;
    string s;
    cin>>k>>s;

    if (k < s.size())
    	s = s.substr(0,k) + "...";

    cout<<s<<endl;



    return 0;
}

Submission status: Runtime Error

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: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
# from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd
# from bisect import bisect_left,bisect_right
# from decimal import *,threading
from fractions import Fraction
mod = int(pow(10, 9)+7)
# mod = 998244353


def ii(): return int(input())


def si(): return str(input())


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


def li1(): return list(mi())


def fii(): return int(stdin.readline())


def fsi(): return str(stdin.readline())


def fmi(): return map(int, stdin.readline().split())


def fli(): return list(fmi())


abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12,
       'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24,
       'z': 25}


def getKey(item): return item[0]


def sort2(l): return sorted(l, key=getKey)


def d2(n, m, num): return [[num for x in range(m)] for y in range(n)]


def isPowerOfTwo(x): return (x and (not (x & (x - 1))))


def decimalToBinary(n): return bin(n).replace("0b", "")


def ntl(n): return [int(i) for i in str(n)]


def powerMod(x, y, p):
    res = 1
    x %= p
    while y > 0:
        if y & 1:
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res


graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000


def bfs(d, v):
    q = []
    q.append(v)
    visited[v] = 1
    while len(q) != 0:
        x = q[0]
        q.pop(0)
        for i in d[x]:
            if visited[i] != 1:
                visited[i] = 1
                q.append(i)
        print(x)


def make_graph(e):
    d = {}
    for i in range(e):
        x, y = mi()
        if x not in d:
            d[x] = [y]
        else:
            d[x].append(y)
        if y not in d:
            d[y] = [x]
        else:
            d[y].append(x)
    return d


def gr2(n):
    d = defaultdict(list)
    for i in range(n):
        x, y = mi()
        d[x].append(y)
    return d


def connected_components(graph):
    seen = set()

    def dfs(v):
        vs = set([v])
        component = []
        while vs:
            v = vs.pop()
            seen.add(v)
            vs |= set(graph[v]) - seen
            component.append(v)
        return component

    ans = []
    for v in graph:
        if v not in seen:
            d = dfs(v)
            ans.append(d)
    return ans


def primeFactors(n):
    s = set()
    while n % 2 == 0:
        s.add(2)
        n = n // 2
    for i in range(3, int(sqrt(n)) + 1, 2):
        while n % i == 0:
            s.add(i)
            n = n // i
    if n > 2:
        s.add(n)
    return s


def find_all(a_str, sub):
    start = 0
    while True:
        start = a_str.find(sub, start)
        if start == -1:
            return
        yield start
        start += len(sub)


def SieveOfEratosthenes(n, isPrime):
    isPrime[0] = isPrime[1] = False
    for i in range(2, n):
        isPrime[i] = True
    p = 2
    while (p * p <= n):
        if (isPrime[p] == True):
            i = p * p
            while (i <= n):
                isPrime[i] = False
                i += p
        p += 1
    return isPrime


def dijkstra(edges, f, t):
    g = defaultdict(list)
    for l, r, c in edges:
        g[l].append((c, r))

    q, seen, mins = [(0, f, ())], set(), {f: 0}
    while q:
        (cost, v1, path) = heappop(q)
        if v1 not in seen:
            seen.add(v1)
            path = (v1, path)
            if v1 == t:
                return (cost, path)

            for c, v2 in g.get(v1, ()):
                if v2 in seen:
                    continue
                prev = mins.get(v2, None)
                next = cost + c
                if prev is None or next < prev:
                    mins[v2] = next
                    heappush(q, (next, v2, path))
    return float("inf")


def binsearch(a, l, r, x):
    while l <= r:
        mid = l + (r-1)//2
        if a[mid]:
            return mid
        elif a[mid] > x:
            l = mid-1
        else:
            r = mid+1
    return -1


# def input():
#    return stdin.buffer.readline()


def readTree(n):
    adj = [set() for _ in range(n)]
    for _ in range(n-1):
        u, v = map(int, input().split())
        adj[u-1].add(v-1)
        adj[v-1].add(u-1)
    return adj


def treeOrderByDepth(n, adj, root=0):
    parent = [-2] + [-1]*(n-1)
    ordered = []
    q = deque()
    q.append(root)
    depth = [0] * n
    while q:
        c = q.popleft()
        ordered.append(c)
        for a in adj[c]:
            if parent[a] == -1:
                parent[a] = c
                depth[a] = depth[c] + 1
                q.append(a)
    return (ordered, parent, depth)


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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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