Orig Description
Score : 300 points
Problem StatementYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.
How many kinds of items did you get?
Constraints
1 \leq N \leq 2\times 10^5
S_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).
InputInput is given from Standard Input in the following format:
N
S_1
:
S_N
OutputPrint the number of kinds of items you got.
Sample Input 13
apple
orange
apple
Sample Output 12
You got two kinds of items: apple and orange.
Sample Input 25
grape
grape
grape
grape
grape
Sample Output 21
Sample Input 34
aaaa
a
aaa
aa
Sample Output 34
Extracted Specification
An integer N (1 ≤ N ≤ 2×10^5), representing some quantity or size.
A list of N strings, where each string consists of lowercase English letters and has a length between 1 and 10 (inclusive).
### Example Input:
```
3
apple
orange
apple
```
### Function Signature:
Write a function f(N, S) that takes in the input.
def f(N: int, S: List[str]):
'''
N: an integer
S: a list of strings
'''
Test Case Generator
Sure, I can write a test case generator for the given problem statement. Here is the Python code that generates test cases for this problem:
```python
import random
import string
def random_string(length):
return ''.join(random.choices(string.ascii_lowercase, k=length))
def tcgen():
# Minimum and Maximum constraints
N = random.randint(1, 2 * 10**5)
# Generating a list of random strings
S = [random_string(random.randint(1, 10)) for _ in range(N)]
return N, S
def print_test_case():
N, S = tcgen()
print(N)
for s in S:
print(s)
# Example usage
if __name__ == "__main__":
print_test_case()
```
### Explanation:
1. **random_string(length)**: Generates a random string of lowercase English letters of given length.
2. **tcgen()**:
- Determines the number of lottery draws \( N \) within the given constraints.
- Generates a list of \( N \) random strings, each string having a length between 1 and 10.
3. **print_test_case()**:
- Calls `tcgen()` to generate a test case.
- Prints the number of draws \( N \).
- Prints each string \( S_i \) on a new line.
This generator ensures that the constraints and input format are correctly followed. You can run the `print_test_case()` function to print a randomly generated test case to the standard output.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
S = [fh.readline().strip() for _ in range(N)]
return N, S
# if __name__ == "__main__":
# input_path = sys.argv[1]
# with open(input_path, 'r') as fh:
# N, S = extract_arguments(fh)
# f(N, S)