팰린드롬인지 확인하기

한경식·2024년 12월 24일

https://www.acmicpc.net/problem/10988

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

string s;
string temp;
bool bResult;

int main()
{
	cin >> s;
	temp = s;
	reverse(s.begin(), s.end());

	if (s == temp)
		bResult = true;

	cout << bResult << endl;
}
  • 생각보다 더 쉬운 문제였다
  • 입력받은 string 변수를 다른 변수에 저장하고 reverse 함수를 이용하여 두 변수를 비교하면 되는 문제이다
profile
게임 개발 지망생

0개의 댓글