using
System;
using
System.Collections.Generic;
class
GFG{
static
string
construct_digits(
string
s)
{
char
[] k = {
'z'
,
'w'
,
'u'
,
'x'
,
'g'
,
'h'
,
'o'
,
'f'
,
'v'
,
'i'
};
string
[] l = {
"zero"
,
"two"
,
"four"
,
"six"
,
"eight"
,
"three"
,
"one"
,
"five"
,
"seven"
,
"nine"
};
int
[] c = { 0, 2, 4, 6, 8, 3, 1, 5, 7, 9 };
List<
string
> ans =
new
List<
string
>();
Dictionary<
char
,
int
> d =
new
Dictionary<
char
,
int
>();
for
(
int
i = 0; i < s.Length; i++)
{
if
(!d.ContainsKey(s[i]))
d[s[i]] = 0;
d[s[i]] += 1;
}
for
(
int
i = 0; i < k.Length; i++)
{
int
x = 0;
if
(d.ContainsKey(k[i]))
x = d[k[i]];
for
(
int
j = 0; j < l[i].Length; j++)
{
if
(d.ContainsKey(l[i][j]))
d[l[i][j]] -= x;
}
ans.Add(((c[i]) * x).ToString());
}
ans.Sort();
string
str = (String.Join(
""
, ans.ToArray()));
return
str.Replace(
"0"
,
""
);
}
public
static
void
Main(
string
[] args)
{
string
s =
"fviefuro"
;
Console.WriteLine(construct_digits(s));
}
}