20131013-12

UVA 11332: simple question, but have some time to solve.