added code for Uva:10954
Merge pull request #13 from rahulroot/10954-code

 added code for Uva:10954