C++)
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
string st;
cin >> st;
string temp = st;
reverse(temp.begin(), temp.end());
(st == temp) ? cout << 1 : cout << 0;
return 0;
}
Python)
import sys
st = sys.stdin.readline().rstrip()
print(1 if st == st[::-1] else 0)'백준 1 > 기타' 카테고리의 다른 글
| [백준 1920] 수 찾기 (C++) (0) | 2020.12.06 |
|---|---|
| [백준 11651] 좌표 정렬하기 - 2 (C++) (0) | 2020.12.06 |
| [백준 11650] 좌표 정렬하기 (C++) (0) | 2020.12.06 |
| [백준 16360] Go Latin (C++) (0) | 2020.12.06 |
| [백준 15874] Caesar Cipher (C++/Python) (0) | 2020.12.06 |