From bda93f87e75bcba7fe881f0333418e78fb9302db Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Wed, 4 May 2022 20:42:05 +0200 Subject: Solved HelpfulMaths codeforces --- HelpfulMaths.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 HelpfulMaths.cpp (limited to 'HelpfulMaths.cpp') 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 + +using namespace std; + +int main() { + string s; + cin >> s; + vector 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'; +} -- cgit v1.2.3