339A - Helpful Maths Codeforces || Codeforces 339A - Helpful Maths Solution

Problem Name: Helpful Maths
Problem Code: 339A
Judge: Codeforces
Problem link: Helpful Maths
Solution on GitHub: Helpful Maths



Codeforces 339A - Helpful Maths Solution in C++/Cpp

#include <bits/stdc++.h>

using namespace std;

int main()
{
    string statement, newStatement;
    cin >> statement;
    for (int i = 0; i < statement.length(); i = i + 2)
    {
        newStatement.push_back(statement[i]);
    }
    sort(newStatement.begin(), newStatement.end());
    for (int i = 0; i < newStatement.length() - 1; i++)
    {
        cout << newStatement[i] << "+";
    }
    cout << newStatement[newStatement.length() - 1] << endl;

    return 0;
}






Next Post Previous Post
No Comment
Add Comment
comment url