Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace apps
- {
- class Program
- {
- static void Main( )
- {
- static int GetInt() { return int.Parse(Console.ReadLine()); }
- static string Get() { return Console.ReadLine(); }
- //-------------------------------------------------------
- int n = GetInt(); // number of given names
- string[] names = new string[n]; // the names
- int[] encrypted = new int[n]; // the codes of the names
- char[] vowels = { 'a', 'e', 'i', 'o', 'u', 'y' }; // vowels for comparison
- int VowelCode ;
- int ConsonantCode = 0;
- //--------------------------------------------
- // GET THE NAMES AND ENCRYPT THEIR CHARS
- //--------------------------------------------
- for (int i = 0; i < n; i++)
- {
- names[i] = Get();
- int len = names[i].Length;
- //----------------------------
- char[] letters = names[i].ToCharArray() ; // get the letters of the name
- for (int Index = i; Index < len; Index++)
- {
- if (vowels.Contains(letters[Index]))
- {
- VowelCode = (int)letters[Index] * n;
- encrypted[i] += VowelCode;
- }
- else
- {
- ConsonantCode += (int)letters[Index] / n;
- encrypted[i] += ConsonantCode;
- }
- }
- }
- //--------------------------------------------
- // MAKE THE ORDER ASCENDING
- //--------------------------------------------
- Array.Sort(encrypted);
- //--------------------------------------------
- // PRINT
- //--------------------------------------------
- for (int i = 0; i < n; i++)
- {
- Console.WriteLine(encrypted[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement