Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created April 11, 2017 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/7e27b1a500573a8beb0cfc999a606339 to your computer and use it in GitHub Desktop.
Save whatalnk/7e27b1a500573a8beb0cfc999a606339 to your computer and use it in GitHub Desktop.
AtCoder ABC #058
a, b, c = gets.chomp.split(" ").map(&:to_i)
if b - a == c - b then
puts "YES"
else
puts "NO"
end
o = gets.chomp.split("")
e = gets.chomp.split("")
o.zip(e).each do |a, b|
print(a, b)
end
puts
n = gets.chomp.to_i
ret = Hash.new{|h, k| h[k] = Array.new()}
n.times do
s = gets.chomp.split("")
h = Hash.new(0)
s.each do |c|
h[c] += 1
end
h.each do |k, v|
ret[k] << h[k]
end
end
ret.keys.sort.each do |k|
if ret[k].size == n then
l = ret[k].min
print(k * l)
end
end
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment