Created
June 22, 2011 08:58
-
-
Save sangohan/1039732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import it.unimi.dsi.fastutil.objects.*; | |
public static void main(String[] args) { | |
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); | |
Object2IntMap h = new Object2IntMap(); | |
String l; | |
int max = 0; | |
try { | |
while ((l = stdin.readLine()) != null) { | |
int x = 1; | |
if (h.containsKey(l)) { | |
x = h.getInt(l) + 1; | |
h.put(l, x); | |
if (x > max) max = x; | |
} else h.put(l, 1); | |
} | |
} catch (IOException e) { | |
} | |
System.out.println(h.size()+"\t"+max); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment