|  | 
|  | 
| вернуться в форум | Wrong answer test 3 in Java 1.7 please help me import java.util.Arrays;import java.util.Scanner;
 
 public class _1496 {
 public static void main(String[] args) {
 
 Scanner s = new Scanner(System.in);
 int amount = s.nextInt();
 if (amount == 0) System.out.println("0");
 else {
 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] = s.nextLine();
 }
 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]);
 }
 }
 }
 }
 }
Re: Wrong answer test 3 in Java 1.7 please help me You have to change Output in case of empty solution from "0" to Empty string. It will solve your problem | 
 | 
|