|
|
back to boardWhy Crash? Hello! This is listing of my class import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class q1496 { /** * @param args * @throws IOException * @throws NumberFormatException */ public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int amount = Integer.parseInt(in.readLine()); String[] source= new String[amount]; String[] uniT= new String[amount]; int j=0; int count=0; for (int i=0;i<amount;i++) { source[i]=in.readLine(); } Arrays.sort(source); uniT[0]=source[0];
for (int i=0;i<amount;i++) { if (source[i].equals(uniT[j])!=true) { j++; uniT[j]=source[i]; } } for (int i=0;i<=j;i++) { count=0; for (int k=0;k<amount;k++) { if (source[k].equals(uniT[i])) { count++; } } if (count>1){System.out.println(uniT[i]);} } } } |
|
|