Module: Hashes


Problem

1/2

Hashes: Start (C++)

Theory Click to read/hide

To solve it, it is convenient to use a hash function that returns a unique value for each row (hash).
C++11 has a built-in facility for getting a hash: hash. < br /> In the future, to count the number of hashes, it is better to use the unordered_map hash table, which also appeared in C++ 11. You can learn more about using map in the course Dynamic data structures -> Associative arrays: map.

An example of getting a hash from the string "test":

hash<string> hash_fn;
size_t str_hash = hash_fn("test" );
cout<<str_hash;


The result will be: "2949673445", so from each unique string you can get a unique hash that can be used as a key in the  unordered_map.

Problem

Given N lines. Print the number of unique rows.

 

Examples
# Input Output
1 3
test
test2
test
2
2 4
1test
test
test1
test
3