added code for Uva:146
Merge pull request #12 from rahulroot/146-code

 added code for Uva:146