Problem: 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.

Submission attempts (in order):

k=int(input()) #take input as integer
s=input()
s1=len(s)
z=0


if k>1 and k<100: #make sure input A is 0<k<100
    if s1>1 and s1<100: #make sure input B is 1<S<100
        if s1<k:
            print(s) #When length k is more than S, print all S
        else:
            while z<k:
                print(s[z],end="") #When length k is less S, print just the index with length k
                z+=1
    else:
        print('Wrong input') #tell the user that the input is wrong
else:
    print('Wrong input') #tell the user that the input is wrong
    
    





#need to use a raw input for one line input because they both defer in data types i.e interger and float
a,b = input().split()
#and then convert them back into respective data types
a=int(a)
b=float(b)
#multiply a and b and then round the answer up before printing
mul=a*b
ans=round(mul)
print(ans)



#DECLARE K AND S INPUT
K = int(input())
S = input()

str = S




if lens(S) > K:
       print(str[0:K]+"...")

else:
       print(str)


while True:
     k = input()
     if 1 <= int(k) <= 100:
         break;
     print ('Error Invalid Input for K')

#Check constraint for K


while True:
     s = input().lower()
     if 1 <= len(s) <= 100:
         break;
     print ('Error Invalid Input for s')

#Check constraint for S

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

# program to print the new string after performing append operation in the string s "..." 
# if only the character s is more than k but if the character s is at most k
# the output will not change
#first we will define the new string

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

str = s
dots = "..."
if len(S) == k:
print(S)
elif len(S) > k:
print (str[0:k],"...")



#firsts we declare string s and k, if character s is at most with char k, it will print char s, no change
#if s i more than k it
#time cpmlexity 0(1)


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

str = s


if lens(s) == k:
                         print(s)

else:
         print (str[0:k] +"...")


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

if len(T) < K :
    print(S)

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

a=input()
b=input()
c=b[:int(a)]
if len(b)>int(a):
    print(c,". . .")
else:
    print(c)

#input an interget
k=int(input())
#input an string
str1=str(input())
#get the length of the string
x=int(len(str1))
#get the difference in length between k and s
i=x-k

#make a second string for the appending
str2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(str1)
#if not, delete the last character of the string
else:
    for i in range(x):
        str1=str1[0 : i : ] + str1[i+1 : : ]
#and then join the two strings together
    newstr="".join((str1,str2))
    print(newstr)

#input an interget
k=int(input())
#input an string
s=str(input())
#get the length of the string
x=int(len(s))
#get the difference in length between k and s
i=k-x

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(s)
#if not, append it
else:
    for i in range(x):
        s=s[0 : i : ] + s[i+1 : : ]
        for i in range(x):
            fix=str('.')
            lenfix=int(len(fix))=x

    print(s.append(fix))

a=input() 
b=input() #string input
if len(b)>int(a): # if exceed the len given
    print(b[:int(a)],". . .")
else:
    print(c)

#input an interget
k=int(input())
#input an string
str1=str(input())
#get the length of the string
x=int(len(str1))
#get the difference in length between k and s
i=x-k

#make a second string for the appending
for i in range(k):
    str2="..."

#if statement about how the string will function
#if the string is the same length as k then print it
if i==0:
    print(str1)
#if not, delete the last character of the string
else:
    for i in range(x):
        str1=str1[0 : i : ] + str1[i+1 : : ]
#and then join the two strings together
    newstr="".join((str1,str2))
    print(newstr)



while True:
     k = int(input())
     if 1 <= int(k) <= 100:
         break;
     print ('Error Invalid Input for K')
#Check constraint k

while True:
     s = input()
     if 1 <= len(s) <= 100:
         break;
     print ('Error Invalid Input for s')
#Check constraint s

if len(s) > k:
    print(s[:k] + "...")  #append
else:
    print(s)

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Accepted