Created
September 3, 2016 06:58
-
-
Save alea12/96b9cffd369a0d766cbe5908277add7e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def is_kaibun?(str) | |
# 奇数長の文字列だった場合、真ん中の文字を削除 | |
if (str.length % 2) == 1 | |
str = str[0, (str.length/2)] + str[((str.length/2)+1), str.length] | |
end | |
str[0, (str.length/2)] === str[str.length/2, str.length].reverse | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment