#C3447. Most Frequent IP Address
Most Frequent IP Address
Most Frequent IP Address
You are given a list of IP addresses. Your task is to find the IP address that occurs most frequently. In case of a tie, return the IP address that appears first in the list.
Formally, let \( f(ip) \) denote the frequency of an IP address ip
in the list. You should output the IP address \( ip^* \) such that
\[
f(ip^*) = \max_{ip} f(ip),
\]
and if there exists more than one such IP address, choose the one that appears first in the input order.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains an integer \( N \) representing the number of IP addresses.
- The next \( N \) lines each contain a single IP address (a non-empty string).
outputFormat
Output to standard output (stdout) a single line containing the IP address that occurs most frequently. In case of ties, output the one that appears first in the list.
## sample6
192.168.1.1
192.168.1.2
192.168.1.1
10.0.0.1
192.168.1.2
192.168.1.1
192.168.1.1