solution to UVA 10192