코딩공부/Softeer

[Softeer/C++]Level2 [한양대 HCPC 2023] X marks the Spot

usingsystem 2024. 3. 8. 12:47
728x90

 

https://softeer.ai/practice/7703/history?questionType=ALGORITHM

 

Softeer - 현대자동차그룹 SW인재확보플랫폼

 

softeer.ai

소스코드

#include <string>
using namespace std;

int main()
{
	int n;
	cin >> n;

	string a, b;

	string result;
	for (int i = 0; i < n; i++)
	{
		cin >> a >> b;

		for (int i = 0;  i < a.size();  i++)
		{
			a[i] = toupper(a[i]);
		}

		size_t idx = a.find("X");

		string temp = b.substr(idx, 1);
		result+=  toupper(temp[0]);
	}
	cout << result;
	return 0;
}
728x90