Middle Strings Miss Roma has got a new job in a computer agency. To test her skills the…
- User
Middle Strings
Miss Roma has got a new job in a computer agency. To test her skills the manager has appointed her with a small project. She will get a string of any length but of ODD length and what she has to do is finding a center string of length 3 in the original string.
For Example: She gets a string 'CANDY' then she needs to display the output 'AND'.
You have to help her. So, develop a code which accepts a string and displays the middle string of length 3.
Strings must be submitted in UPPER CASE only. If String is of length less than 3 display output as 0. Input First line consists of a string of ODD length which is in uppercase.
Output Second Line displays the appropriate output of length 3
Example
Input: CANDY
Output: AND
Input: SOLVING
Output: LVI
Assistant
pythons = input().strip() if len(s) < 3: print(0) else: start = (len(s) - 3) // 2 print(s[start:start+3])
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.