Santosh Betha's submission of pattern29 | CodeChef