def chess960_to_spid(pos)
  start_str = pos.tr(, )
  
  s = start_str.delete()
  n = [0,1,2,3,4].combination(2).to_a.index( [s.index(), s.rindex()] )
  
  q = start_str.delete().index()
  
  bs = start_str.index(), start_str.rindex()
  d = bs.detect(&:even?).div(2)
  l = bs.detect(&:odd? ).div(2)

  96*n + 16*q + 4*d + l
end

positions = [, ]
positions.each{|pos| puts  }