2009-05-18
流行りのケブンリッジ関数 - JavaScript 編
はめじに
いま どかうく .rog で けっりぶんじ かすんう が はいてっやる ので さそっく じぷりくすばゃと で じうっそ しみてた
String.prototype.cmabrigde = function() { return this.split(' ').map(function(w) { var ws = w.split(''); var l = ws.pop(); return (ws.shift() || '') + (ws.length ? ws.sort(Math.random).join('') : '') + l; }).join(' '); };
さこんう URL
C++ だと こなんかんじ?
#include <iostream> #include <string> #include <algorithm> int main() { std::string w; while (std::cin >> w) { std::random_shuffle(w.begin() + 1, w.end() - 1); std::cout << w << " "; } }
トラックバック - http://d.hatena.ne.jp/amachang/20090518/1242656425
リンク元
- 106 http://reader.livedoor.com/reader/
- 86 http://www.google.co.jp/search?hl=ja&client=firefox-a&rls=org.mozilla:ja:official&hs=Lo5&q=はてブ ワイルドカード 検索&btnG=検索&lr=lang_j
- 85 http://amachang.sakura.ne.jp/misc/matrix/
- 70 http://www.nobodyplace.com/mutter/2009/03/20/140902.php
- 55 http://www.google.co.jp/search?sourceid=navclient&hl=ja&ie=UTF-8&rlz=1T4GFRD_ja&q="$(function()+"
- 51 http://www.google.co.jp/reader/view/
- 46 http://www.google.co.jp/search?q=javascript+連想配列&lr=lang_ja&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&client=firefox-a
- 40 http://www.google.com/reader/view/
- 35 http://amachang.sakura.ne.jp/misc/matrix/?data=ドラえもん,野比のび太,源静香,剛田武,骨川スネ夫,?%
- 27 http://d.hatena.ne.jp/
