기러기 토마토 스위스 인도인 별똥별 우영우 ..역삼역
Bash
bash
read str
rev=""
cnt=${#str}
while [ 0 -lt $cnt ]; do
((cnt--))
rev+=${str:$cnt:1}
done
test "$str" == "$rev" && echo 1 || echo 0
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
Node.js
javascript
const str = require("fs").readFileSync(0).toString().trim();
const rev = str.split("").reverse().join("");
const o = str == rev ? 1 : 0;
console.log(o);
1
2
3
4
2
3
4
Python3
python
a = input()
o = 1 if a == a[::-1] else 0
print(o)
1
2
3
2
3
Ruby
ruby
str = gets.chomp
o = str == str.reverse ? 1 : 0
puts o
1
2
3
2
3
Comments
Not supported comment edit and upvote
You can do it on this page if you want.