https://kasumiblog.org/ruby-each_with_index/
Rubyで配列からインデックス(index)と値を同時に取り出す方法