Highest occurring digit

0

0 votes
Easy
Problem

Given a number N, the task is to find the highest occurring digit in prime numbers less or equal to N. If multiple digits have same highest frequency, print the largest of them.

Input Format

Input contains a single integer N.

Output Format

Output single integer denoting the answer.

Constraints :

2<=N<=10^6

Time Limit: 0.5
Memory Limit: 256
Source Limit:
Explanation

Prime numbers less than 20 are 2, 3, 5, 7, 11, 13, 17, 19. 1 occur maximum i.e 5 times among 0 to 9.

Editor Image

?