Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- long[] encryptedStrings = ReturnEncryptedStrings(n);
- Console.Write(string.Join("\n", encryptedStrings.OrderBy(s => s)));
- }
- private static long[] ReturnEncryptedStrings(int n)
- {
- long[] encryptedStrings = new long[n];
- for (int i = 0; i < n; i++)
- {
- string input = Console.ReadLine();
- long encryptedInput = EcryptString(input);
- encryptedStrings[i] = encryptedInput;
- }
- return encryptedStrings;
- }
- private static long EcryptString(string input)
- {
- long encryptedString = 0;
- int stringLength = input.Length;
- for (int i = 0; i < input.Length; i++)
- {
- char current = input[i];
- int charAsNum = ReturnCharAsNum(input, current);
- encryptedString += charAsNum;
- }
- return encryptedString;
- }
- private static int ReturnCharAsNum(string input, char current)
- {
- int stringLength = input.Length;
- int charAsNum = 0;
- switch (current)
- {
- case 'a':
- case 'A':
- case 'e':
- case 'E':
- case 'i':
- case 'I':
- case 'o':
- case 'O':
- case 'u':
- case 'U':
- charAsNum = (byte)current * stringLength;
- break;
- case 'b':
- case 'B':
- case 'c':
- case 'C':
- case 'd':
- case 'D':
- case 'f':
- case 'F':
- case 'g':
- case 'G':
- case 'h':
- case 'H':
- case 'j':
- case 'J':
- case 'k':
- case 'K':
- case 'l':
- case 'L':
- case 'm':
- case 'M':
- case 'n':
- case 'N':
- case 'p':
- case 'P':
- case 'q':
- case 'Q':
- case 'r':
- case 'R':
- case 's':
- case 'S':
- case 't':
- case 'T':
- case 'v':
- case 'V':
- case 'w':
- case 'W':
- case 'x':
- case 'X':
- case 'y':
- case 'Y':
- case 'z':
- case 'Z':
- charAsNum = (byte)current / stringLength;
- break;
- default:
- break;
- }
- return charAsNum;
- }
Advertisement
Add Comment
Please, Sign In to add comment