Added problem 2 solutions in Ruby, Python, C, and C++