solution to UVA 11385