Advertisement
Stan0033

Untitled

Jun 22nd, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace apps
  5. {
  6. class Program
  7. {
  8. static void Main( )
  9. {
  10. static int GetInt() { return int.Parse(Console.ReadLine()); }
  11. static string Get() { return Console.ReadLine(); }
  12.  
  13. //-------------------------------------------------------
  14. int n = GetInt(); // number of given names
  15. string[] names = new string[n]; // the names
  16. int[] encrypted = new int[n]; // the codes of the names
  17. char[] vowels = { 'a', 'e', 'i', 'o', 'u', 'y' }; // vowels for comparison
  18. int VowelCode ;
  19. int ConsonantCode = 0;
  20.  
  21. //--------------------------------------------
  22. // GET THE NAMES AND ENCRYPT THEIR CHARS
  23. //--------------------------------------------
  24. for (int i = 0; i < n; i++)
  25. {
  26. names[i] = Get();
  27. int len = names[i].Length;
  28. //----------------------------
  29.  
  30. char[] letters = names[i].ToCharArray() ; // get the letters of the name
  31. for (int Index = i; Index < len; Index++)
  32. {
  33. if (vowels.Contains(letters[Index]))
  34. {
  35. VowelCode = (int)letters[Index] * n;
  36. encrypted[i] += VowelCode;
  37. }
  38. else
  39. {
  40. ConsonantCode += (int)letters[Index] / n;
  41. encrypted[i] += ConsonantCode;
  42. }
  43.  
  44.  
  45. }
  46. }
  47. //--------------------------------------------
  48. // MAKE THE ORDER ASCENDING
  49. //--------------------------------------------
  50. Array.Sort(encrypted);
  51. //--------------------------------------------
  52. // PRINT
  53. //--------------------------------------------
  54. for (int i = 0; i < n; i++)
  55. {
  56. Console.WriteLine(encrypted[i]);
  57. }
  58.  
  59.  
  60.  
  61. }
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement