diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-04 20:42:05 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-04 20:42:05 +0200 |
| commit | bda93f87e75bcba7fe881f0333418e78fb9302db (patch) | |
| tree | 9c4518b0d17a46756567bf3f3555ea0f516789b6 | |
| parent | 6d7b9aae2f3f6a83cf0517ae96f3258e7191ce56 (diff) | |
| download | competitive-programming-bda93f87e75bcba7fe881f0333418e78fb9302db.tar.xz competitive-programming-bda93f87e75bcba7fe881f0333418e78fb9302db.zip | |
Solved HelpfulMaths codeforces
| -rw-r--r-- | HelpfulMaths.cpp | 24 |
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'; +} |
