ABC184

https://atcoder.jp/contests/abc184
 

A: Determinant

a, b, c, d = readlines.join.split.map(&:to_i)
puts a * d - b * c

 

B: Quizzes

n, x = gets.split.map(&:to_i)
str = gets.chomp

str.each_char do |s|
  case s
  when "o"
    x += 1
  else
    x -= 1 if x.nonzero?
  end
end

puts x