Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- int n = Integer.parseInt(input.nextLine());
- int[] numbers = new int[n];
- for (int i = 0; i < n; i++){
- String name = input.nextLine();
- int len = name.length();
- int sum = 0;
- for (int j = 0; j < len; j++) {
- char currentChar = name.charAt(j);
- if(isVowel(currentChar)) {
- sum+= currentChar * len;
- } else{
- sum += currentChar /len;
- }
- }
- numbers[i] = sum;
- }
- Arrays.sort(numbers);
- for (int element : numbers){
- System.out.println(element);
- }
- }
- public static boolean isVowel(char c) {
- String vowels = "aeiouAEIOU";
- return vowels.contains(c + "");
- }
- public static boolean isConstant(char c) {
- String cons = "qwrtpsdfghjklzxcvbnmQWRTPSDFGHJKLZXCVBNM";
- return cons.contains(c + "");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement