-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path(339)Helpful_Maths.cs
48 lines (47 loc) · 1.2 KB
/
(339)Helpful_Maths.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Helpful_Maths
{
class Program
{
static void Main(string[] args)
{
int c = 0;
string s = Console.ReadLine();
if (s.Length == 1)
{
Console.WriteLine(s);
}
else
{
int n = s.Length - (s.Length / 2);
char[] num = new char[n];
for (int i = 0; i < s.Length; i++)
{
if (s[i] == '+')
{
continue;
}
else
{
num[c] = s[i];
c++;
}
}
Array.Sort(num);
for (int i = 0; i < c; i++)
{
Console.Write(num[i]);
if(i==c-1)
{
break;
}
Console.Write("+");
}
}
}
}
}