aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HelpfulMaths.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/HelpfulMaths.cpp b/HelpfulMaths.cpp
new file mode 100644
index 0000000..580b2fa
--- /dev/null
+++ b/HelpfulMaths.cpp
@@ -0,0 +1,24 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main() {
+ string s;
+ cin >> s;
+ vector<int> v;
+ for (auto ch : s) {
+ if(ch != '+') {
+ v.push_back(ch - 48);
+ }
+ }
+ sort(v.begin(), v.end());
+ for(int i = 0; i < v.size(); i++) {
+ if(i == v.size() - 1) {
+ cout << v[i];
+ }
+ else {
+ cout << v[i] << "+";
+ }
+ }
+ cout << '\n';
+}