Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _01.EncryptSortandPrintArray
- {
- using System;
- using System.Linq;
- public class Program
- {
- public static void Main()
- {
- int numberStrings = int.Parse(Console.ReadLine());
- int[] numbers = new int[numberStrings];
- string vowels = "aAeEiIoOuU";
- char[] vowelsArr = vowels.ToCharArray();
- string consonants = "bBcCdDfFgGhHjJkKlLmMnNpPqQrRsStTvVwWxXyYzZ";
- char[] consonantsArr = consonants.ToCharArray();
- for (int i = 0; i < numberStrings; i++)
- {
- string word = Console.ReadLine();
- char[] letters = word.ToCharArray();
- int sum = 0;
- for (int j = 0; j < letters.Length; j++)
- {
- char currentChar = letters[j];
- if(vowelsArr.Contains(currentChar))
- {
- sum += letters[j] * letters.Length;
- }
- else if(consonantsArr.Contains(currentChar))
- {
- sum += letters[j] / letters.Length;
- }
- }
- numbers[i] = sum;
- }
- Array.Sort(numbers);
- foreach (var element in numbers)
- {
- Console.WriteLine($"{element}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment