codeforces 339A solution in c/c++

// 339A.cpp : This file contains the 'main' function. Program execution begins and ends there.
//


#include <iostream>
# include<string>
using namespace std;

int main()
{
string anis;
cin >> anis;
int v = anis.length();//determine string length
int c = anis[0];
int temp;
for (int i = 0;i < v;i+=2)
{

for (int j = i + 2;j < v;j+=2)
{

if (anis[i] > anis[j])
{

temp = anis[i];
anis[i] = anis[j];
anis[j] = temp;
}
}

}

cout << anis;
   
}


Comments

Popular posts from this blog

codeforces 472A problem solution in simple c/c++

codeforces 520A problem solution in c/c++