JAVA задача 01. Encrypt, Sort and Print Array
Моля за помощ. Нулевите тестове минават, но от другите 0 %. Не разбирам какъв е проблема.
Arrays - More Exercise - SoftUni Judge
package demo.StreamsInJava; import java.util.Arrays; import java.util.Scanner; public class EncryptSortAndPrintArray { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = Integer.parseInt(scanner.nextLine()); int[] arr = new int[n]; int nLines = 0; while(nLines != n) { String line = scanner.next(); int nSum = 0; for (int i = 0; i < line.length(); i++) { int indexOfLineAsInt = (int)line.charAt(i); if(indexOfLineAsInt == (int) 'a' || indexOfLineAsInt == (int) 'o' || indexOfLineAsInt == (int) 'u' || indexOfLineAsInt == (int) 'e' || indexOfLineAsInt == (int) 'i') { indexOfLineAsInt *= line.length(); nSum += indexOfLineAsInt; } else { indexOfLineAsInt /= line.length(); nSum += indexOfLineAsInt; } } arr[nLines] = nSum; nLines++; } Arrays.sort(arr); for (int number: arr) { System.out.println(number); } } }