Last active
January 20, 2016 07:34
-
-
Save whatalnk/ebb9092dfb039efe9d51 to your computer and use it in GitHub Desktop.
AtCoder ARC #047
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, l = gets.chomp.split(" ").map(&:to_i) | |
s = gets.chomp.split("") | |
tab_open = 1 | |
n_crash = 0 | |
s.each do |i| | |
if i == "+" then | |
tab_open += 1 | |
else | |
tab_open -= 1 if tab_open > 1 | |
end | |
if tab_open > l then | |
n_crash += 1 | |
tab_open = 1 | |
end | |
end | |
puts n_crash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment