uva-10635.cpp