programming/알고스팟

알고스팟 - 튜토리얼 encrypt

Ryuuu 2020. 5. 14. 23:26

겁나 쉽다. 튜토리얼에 딱맞는거 같다 ㅎㅎ


using namespace std;
void sort_func(string origin);
int main(){
	
	int i;
	int num;
	vector input;
	string temp;
	
	cin >> num;
	
	for(i = 0; i < num; i++){
		cin >> temp;
		input.push_back(temp);
	}
	
	for(i = 0; i < num; i++){
		sort_func(input[i]);
	}
	
}

void sort_func(string origin){
	int i;
	string even="";
	string odd="";
	
	for(i = 0; i < origin.length(); i++){
		if(i%2==0)
			even += origin[i];
		else
			odd += origin[i];
	}
	
	cout << even << odd << endl;
}