Orig Description
Score : 100 points
Problem StatementRng is going to a festival.
The name of the festival is given to you as a string S, which ends with FESTIVAL, from input. Answer the question: "Rng is going to a festival of what?" Output the answer.
Here, assume that the name of "a festival of s" is a string obtained by appending FESTIVAL to the end of s.
For example, CODEFESTIVAL is a festival of CODE.
Constraints
9 \leq |S| \leq 50
S consists of uppercase English letters.
S ends with FESTIVAL.
InputInput is given from Standard Input in the following format:
S
OutputPrint the answer to the question: "Rng is going to a festival of what?"
Sample Input 1CODEFESTIVAL
Sample Output 1CODE
This is the same as the example in the statement.
Sample Input 2CODEFESTIVALFESTIVAL
Sample Output 2CODEFESTIVAL
This string is obtained by appending FESTIVAL to the end of CODEFESTIVAL, so it is a festival of CODEFESTIVAL.
Sample Input 3YAKINIKUFESTIVAL
Sample Output 3YAKINIKU
Extracted Specification
An uppercase English string S with length between 9 and 50, inclusive, that ends with the substring "FESTIVAL".
### Example Input:
```
CODEFESTIVAL
```
### Function Signature:
Write a function f(S) that takes in the input.
def f(S: str):
'''
S: a string
'''
Test Case Generator
Sure! Below is a test case generator for the given problem statement "Rng is going to a festival":
```python
import random
import string
def tcgen():
# The minimum length of the string is 9 and the maximum is 50.
min_length_of_festival = 8 # Length of the word "FESTIVAL"
min_length = 9
max_length = 50
# Generate the length of the random part of the string
random_part_length = random.randint(min_length - min_length_of_festival, max_length - min_length_of_festival)
# Generate the random part of the string consisting of uppercase English letters
random_part = ''.join(random.choices(string.ascii_uppercase, k=random_part_length))
# Append "FESTIVAL" to the random part
S = random_part + "FESTIVAL"
return S
# Example usage:
for _ in range(5): # Generate 5 test cases
print(tcgen())
```
This generator will create random strings that conform to the constraints given in the problem statement. Each generated string will end with "FESTIVAL" and will have a total length between 9 and 50 characters. The part of the string before "FESTIVAL" will be randomly composed of uppercase English letters.
You can adjust the number of test cases generated by changing the range in the example usage.
Extract Arguments
def extract_arguments(fh):
S = fh.readline().strip()
return S