Orig Description
Score : 100 points
Problem StatementThis contest is CODE FESTIVAL.
However, Mr. Takahashi always writes it CODEFESTIVAL, omitting the single space between CODE and FESTIVAL.
So he has decided to make a program that puts the single space he omitted.
You are given a string s with 12 letters.
Output the string putting a single space between the first 4 letters and last 8 letters in the string s.
Constraints
s contains exactly 12 letters.
All letters in s are uppercase English letters.
InputThe input is given from Standard Input in the following format:
s
OutputPrint the string putting a single space between the first 4 letters and last 8 letters in the string s.
Put a line break at the end.
Sample Input 1CODEFESTIVAL
Sample Output 1CODE FESTIVAL
Putting a single space between the first 4 letters and last 8 letters in CODEFESTIVAL makes it CODE FESTIVAL.
Sample Input 2POSTGRADUATE
Sample Output 2POST GRADUATE
Sample Input 3ABCDEFGHIJKL
Sample Output 3ABCD EFGHIJKL
Extracted Specification
An uppercase string \(s\) of length 12.
### Example Input:
```
CODEFESTIVAL
```
### Function Signature:
Write a function f(s) that takes in the input.
```python
def f(s: str):
'''
s: an uppercase string of length 12
'''
```
Test Case Generator
To create a test case generator for the given problem statement, we need to generate a random string of exactly 12 uppercase English letters. Here is a Python function that generates such test cases:
```python
import random
import string
def tcgen():
# Generate a random string s of exactly 12 uppercase English letters
s = ''.join(random.choices(string.ascii_uppercase, k=12))
return s
# Example use case
if __name__ == "__main__":
for _ in range(5): # Generate 5 test cases
s = tcgen()
print(f"Input: {s}")
# Generating the expected output for our understanding (not needed in actual test case generation)
expected_output = s[:4] + ' ' + s[4:]
print(f"Expected Output: {expected_output}\n")
```
This function generates a random string `s` of exactly 12 uppercase English letters, which conforms to the constraints given in the problem statement.
Here's what the `tcgen` function does:
1. Uses `random.choices()` to select 12 random characters from `string.ascii_uppercase`, which contains all uppercase English letters.
2. Joins these characters into a single string `s`.
In the example use case provided, it generates 5 test cases and prints them along with their expected outputs. The expected output is calculated by inserting a space between the first 4 and the last 8 characters of the string `s`.
Extract Arguments
def extract_arguments(fh):
s = fh.readline().strip()
return s