def sospa(location)
      string    = location[1..-1]
      col       = location[0].to_i
      row       = (string.length.to_f / col).floor
      remainder = string.length % col
      address   = [[nil]*col]*(row+1)

      sizes = [row+1] * remainder + [row] * (col - remainder)
      pos = 0
      sizes.each_with_index { |size, i|
        size.times { |index| address[col * index + i] = string[pos + index] }
        pos += size
      }

      address = CGI::unescape(address.join).gsub('^', '0')
    rescue
      raise location
    end
def sospa(location)
      string    = location[1..-1]
      col       = location[0].to_i
      row       = (string.length.to_f / col).floor
      remainder = string.length % col
      address   = [[nil]*col]*(row+1)

      sizes = [row+1] * remainder + [row] * (col - remainder)
      pos = 0
      sizes.each_with_index { |size, i|
        size.times { |index| address[col * index + i] = string[pos + index] }
        pos += size
      }

      address = CGI::unescape(address.join).gsub('^', '0')
    rescue
      raise location
    end
Rewrite the algorithm, much much more better.