#K5916. Count Unique Athletes
Count Unique Athletes
Count Unique Athletes
You are given an integer \( M \) representing the number of events held. Each of the following \( M \) lines contains a list of athlete IDs (alphanumeric strings) separated by spaces. Some athletes may participate in multiple events. Your task is to determine the total number of unique athletes across all events.
In mathematical notation, if the athlete list for each event \( i \) is represented by a set \( S_i \), then the answer is given by:
\[ |\bigcup_{i=1}^{M} S_i| \quad \]Note: When \( M = 0 \), there will be no events and the answer should be 0.
inputFormat
The input is read from standard input (stdin) in the following format:
- The first line contains an integer \( M \) (the number of events).
- The following \( M \) lines each contain space-separated athlete IDs representing the participants of that event.
outputFormat
Print one integer to standard output (stdout) representing the total number of unique athletes across all events.
## sample4
A1 B2 C3
A1 C3 D4
B2
E5
5
</p>