Middle N Characters in String: Given a String S and an integer N as input, the program must print the N characters present in the middle of the string. If the length of S is even and N is odd print the character from the second half of the string as the output.

Boundary Condition(s):
3 <= Length of S <= 100
3 <= N <= 100

Input Format:
The first line contains the String S.
The second line contains the value of N.

Output Format:
The first line contains the N characters present in the middle of the string.

Example Input/Output 1:
Input:
hello
3

Output:
ell

Explanation:
There are 5 characters in the given string -> h e l l o
The middle 3 characters are e l l
Hence the output is ell

Example Input/Output 2:
Input:
whatsapp
5

Output:
atsap

Explanation:
There are 8 characters in the given string -> w h a t s a p p
The middle 5 characters are a t s a p
Hence the output is atsap

``````s=input().strip()
n=int(input())
d=len(s)-n
if n:
l=s[(d+1)//2:len(s)-(d//2)]
print(l)``````
Claps!
9
{"ft_lang_label":"__label__en","ft_lang_prob":0.77042127,"math_prob":0.9851932,"size":968,"snap":"2020-45-2020-50","text_gpt3_token_len":263,"char_repetition_ratio":0.16078839,"word_repetition_ratio":0.12222222,"special_character_ratio":0.27892563,"punctuation_ratio":0.09633028,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9945116,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-12-01T09:09:21Z\",\"WARC-Record-ID\":\"<urn:uuid:837e39d7-ffac-47ac-a553-0a9737310ed9>\",\"Content-Length\":\"176152\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:539dfcb6-6678-413e-b28f-91fb2172956e>\",\"WARC-Concurrent-To\":\"<urn:uuid:043d6d5f-4b1b-4d26-bbb9-554220126303>\",\"WARC-IP-Address\":\"104.18.32.242\",\"WARC-Target-URI\":\"https://letuscrack.com/middle-n-characters-in-string/\",\"WARC-Payload-Digest\":\"sha1:XQEFPV2SRKPTEEJF6WFDTLX66O3FI3GA\",\"WARC-Block-Digest\":\"sha1:MSP3PCRMIXBKQYDEI3WRHOZH3FANHADB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141672314.55_warc_CC-MAIN-20201201074047-20201201104047-00221.warc.gz\"}"}