Skip to content
This repository has been archived by the owner on Nov 22, 2020. It is now read-only.

Commit

Permalink
まさか改行の代わりにセミコロンが使えるとか知らなかったわ
Browse files Browse the repository at this point in the history
まさか改行の代わりにセミコロンが使えるとか知らなかったわ
Rubyのドキュメント眺めてて気付いた
result:
https://paiza.jp/poh/joshibato/matsue-ruby/result/382a54d0
  • Loading branch information
neetsdkasu committed Sep 4, 2015
1 parent ef58a3c commit 4a9b00f
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions POH6plus/answer5.rb
@@ -1,8 +1 @@
f,s=Hash.new(0),c=""
gets.to_i.times{f[gets.chop]+=1}
f.keys.sort.map{|x|y=x.reverse
m,f[x],b=[f[x],f[y]].min,0,x==y
c,m=x,m-1if b&m&&(!c||c<x)
b&&m/=2
m.times{s+=x}}
$><<s+c+s.reverse
f,s=Hash.new(0),c='';gets.to_i.times{f[gets.chop]+=1};f.keys.sort.map{|x|y=x.reverse;m,f[x],b=[f[x],f[y]].min,0,x==y;c,m=x,m-1if b&m&&(!c||c<x);b&&m/=2;m.times{s+=x}};$><<s+c+s.reverse

0 comments on commit 4a9b00f

Please sign in to comment.