본문 바로가기
Programming/Judge

Algospot : LECTURE

by deviAk 2014. 12. 12.
반응형


https://algospot.com/judge/problem/read/LECTURE


<결과>


<코드>

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main(void) 
{	
	int num_cases = 0;
	cin >> num_cases;
	
	for (int i = 0; i < num_cases; ++i)
	{
		vector<string> vec_string;
		string in_str, str_result;
		cin >> in_str;

		int half_size = in_str.length() / 2;
		for (int j = 0; j < half_size; ++j) 
		{
			vec_string.push_back(in_str.substr(j * 2, 2));
		}
		
		sort(vec_string.begin(), vec_string.end());

		for (int j = 0; j < vec_string.size(); ++j)
		{
			str_result += vec_string[j];
		}
		
		cout << str_result << endl;
		vec_string.clear();
	}
	return 0;
}


반응형