Little Jay

[C++] 백준 1259번 팰린드롬수 본문

알고리즘/BOJ

[C++] 백준 1259번 팰린드롬수

Jay, Lee 2021. 3. 8. 21:29
#include <iostream>
#include <string>
using namespace std;

int main() {

	bool check = true;

	while (check) {
		string s;
		cin >> s;
		if (s == "0") {
			break;
		}
		int len = s.length();
		int count = 0;
		for (int i = 0; i < len - 1; i++) {
			if (s[i] == s[len - i - 1]) {
				continue;
			}
			else {
				count++;
			}
		}
		if (count > 0) {
			cout << "no" << "\n";
		}
		else {
			cout << "yes" << "\n";
		}
	}


	return 0;
}
Comments