Created
February 15, 2016 12:30
-
-
Save amashigeseiji/abc81b8425292eab75ed 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
class String | |
def cabmridge | |
tmp = [] | |
split(' ').each do |word| | |
tmp2 = [] | |
chars = word.chars | |
first = chars.shift | |
last = chars.pop | |
tmp.push tmp2.push(first).concat(chars.shuffle).push(last).join('') | |
end | |
tmp.join(' ') | |
end | |
end | |
p 'この ぶんしょう は いぎりす の ケンブリッジ だいがく の けんきゅう の けっか にんげんは もじ を にんしき する とき その さいしょ と さいご の もじさえ あっていれば じゅんばん は めちゃくちゃ でも ちゃんと よめる という けんきゅう に もとづいて わざと もじの じゅんばん を いれかえて あります'.cabmridge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
コメントいまさら気づきました!
一時変数やだなとは思ってましたが、なるほどです。