Advertisement
fk4m1913

Untitled

Jun 10th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace EncryptSortAndPrintArray
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int stringsCount = int.Parse(Console.ReadLine());
  11.             int[] sums = new int[stringsCount];
  12.             char[] vowels = { 'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U' };
  13.  
  14.             for (int i = 0; i < stringsCount; i++)
  15.             {
  16.                 string text = Console.ReadLine();
  17.                 int currSum = 0;
  18.  
  19.                 for (int j = 0; j < text.Length; j++)
  20.                 {
  21.                     bool isMatch = false;
  22.  
  23.                     for (int k = 0; k < vowels.Length; k++)
  24.                     {
  25.                         if (text[j] == vowels[k])
  26.                         {
  27.                             isMatch = true;
  28.                             break;
  29.                         }
  30.                     }
  31.  
  32.                     if (isMatch == true)
  33.                     {
  34.                         currSum += text[j] * text.Length;
  35.                     }
  36.  
  37.                     else
  38.                     {
  39.                         currSum += text[j] / text.Length;
  40.                     }
  41.                 }
  42.  
  43.                 sums[i] = currSum;
  44.             }
  45.  
  46.             Array.Sort(sums);
  47.  
  48.             for (int i = 0; i < sums.Length; i++)
  49.             {
  50.                 Console.WriteLine(sums[i]);
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement