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 integer N (9 ≤ N ≤ 50), representing the length of a string.
A string S of length N, consisting of uppercase English letters, ending with a specific substring.
### Example Input:
```
12
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 the test case generator for the given problem statement "Rng is going to a festival":
```python
import random
import string
def tcgen():
# Define the minimum and maximum length of the string S
min_length = 9
max_length = 50
# Generate a random length for the string S that satisfies the constraints
length_of_s = random.randint(min_length, max_length)
# Generate a random prefix (the part of S before "FESTIVAL")
prefix_length = length_of_s - len("FESTIVAL")
prefix = ''.join(random.choices(string.ascii_uppercase, k=prefix_length))
# Construct the final string S by appending "FESTIVAL" to the prefix
S = prefix + "FESTIVAL"
return S
# Example usage
if __name__ == "__main__":
test_case = tcgen()
print(test_case)
```
This code will generate a random test case for the problem where the string `S` ends with "FESTIVAL" and its length is between 9 and 50 characters. The prefix of `S` will be composed of uppercase English letters. This ensures that the generated test case adheres to the constraints provided in the problem statement.
You can run this script multiple times to get different test cases for your competitive programming problem.
Extract Arguments
def extract_arguments(fh):
S = fh.readline().strip()
return S