added code for Uva:12157
Merge pull request #26 from rahulroot/12157-code

added code for Uva:12157