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, A) that takes in the input.
```python
def f(N: int, A: List[str]):
'''
N: an integer
A: a list of strings
'''
```
Test Case Generator
Sure! Let's create a test case generator for the provided problem. This generator will create random test cases while ensuring that the constraints are respected.
Here is the Python code for the test case generator:
```python
import random
import string
def tcgen():
# Generate a random value for N within the specified range
N = random.randint(1, 2 * 10**5)
# Generate N random strings, each string's length between 1 and 10,
# and consisting of lowercase English letters.
strings = []
for _ in range(N):
length = random.randint(1, 10)
s = ''.join(random.choices(string.ascii_lowercase, k=length))
strings.append(s)
# Return N and the list of strings
return N, strings
# Example usage:
N, strings = tcgen()
print(N)
for s in strings:
print(s)
```
### Explanation
- **N Generation**: It generates a random integer \(N\) in the range \([1, 2 \times 10^5]\).
- **String List Generation**: It generates \(N\) random strings. Each string's length is between 1 and 10, and the string consists of lowercase English letters.
### Example Output
When you run the `tcgen()` function, it might produce an output like the following:
```
5
abc
defgh
ijklmnop
qrstuvwx
yz
```
This output represents:
- \(N = 5\) (number of draws)
- 5 strings: "abc", "defgh", "ijklmnop", "qrstuvwx", "yz"
You can use this generator to create random test cases for testing the solution to the problem.
Extract Arguments
def extract_arguments(fh):
N = int(fh.readline().strip())
S = [fh.readline().strip() for _ in range(N)]
return N, S