@kyanny's blog

我々の目的は何かと聞かれて、私はたった一つの言葉で答えることができる。勝利。それだけだ - ウィンストン・チャーチル

間違い探し

irb(main):010:0> s
=> "PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5P5SPS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5"
irb(main):011:1* s.scan(/.../)
=> ["PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "P5S", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5", "PS5"]
irb(main):012:0> s.scan(/.../).uniq
=> ["PS5", "P5S"]
irb(main):013:1* s.gsub(s.scan(/.../).uniq[0], '___')
=> "______________________________________________________________________________________________________________________________P5S_______________________________________________________________________________________________________________"
irb(main):014:0> s.gsub(s.scan(/.../).uniq[1], '___')
=> "PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5___PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5PS5"
irb(main):015:0> s.gsub(s.scan(/.../).uniq[0], '___').index('P')
=> 126