Skip to content

Instantly share code, notes, and snippets.

@alea12
Created September 3, 2016 06:58
Show Gist options
  • Save alea12/96b9cffd369a0d766cbe5908277add7e to your computer and use it in GitHub Desktop.
Save alea12/96b9cffd369a0d766cbe5908277add7e to your computer and use it in GitHub Desktop.
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