using
System;
using
System.Collections.Generic;
namespace
sticks
{
class
Program
{
public
static
int
[] sticks = { 6, 7, 4, 6, 5, 4, 6,
5, 2, 4, 4, 3, 6, 6,
6, 5, 7, 6, 5, 3, 5,
4, 6, 4, 3, 4 };
public
static
int
[] number = { 6, 2, 5, 5, 4, 5, 6,
3, 7, 6 };
public
static
int
countSticks(
string
str)
{
int
cnt = 0;
for
(
int
i = 0; i < str.Length; i++)
{
char
ch = str[i];
if
(ch >=
'A'
&& ch <=
'Z'
)
{
cnt += sticks[ch -
'A'
];
}
else
{
cnt += number[ch -
'0'
];
}
}
return
cnt;
}
public
static
void
sortArr(
string
[] arr,
int
n)
{
List<KeyValuePair<
int
,
string
>> vp =
new
List<KeyValuePair<
int
,
string
>>();
for
(
int
i = 0; i < n; i++)
{
vp.Add(
new
KeyValuePair<
int
,
string
>(countSticks(arr[i]), arr[i]));
}
vp.Sort((x, y) => x.Key.CompareTo(y.Key));
for
(
int
i = 0; i < vp.Count; i++)
Console.Write($
"{vp[i].Value} "
);
Console.WriteLine();
}
static
void
Main(
string
[] args)
{
string
[] arr = {
"GEEKS"
,
"FOR"
,
"GEEKSFORGEEKS"
};
int
n = arr.Length;
sortArr(arr, n);
}
}
}