백준 10988 회문(팰린드롬)

CJB_ny·2022년 12월 29일
0

백준

목록 보기
24/104
post-thumbnail

팰린드롬

내가 푼거

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

int cmps(string str)
{
	for (int i = 0; i < str.size(); ++i)
		if (str[i] != str[str.size() - i - 1]) return 0;
	
	return 1;
}

int main()
{
	string str;
	cin >> str;

	cout << cmps(str);
	
	return 0;
}

다른풀이

reverse하면 "원본 배열"에 영향을 준다.

profile
https://cjbworld.tistory.com/ <- 이사중

0개의 댓글