added code for Uva:12554
Merge pull request #25 from rahulroot/12554-code

added code for Uva:12554