solution to http://www.checkio.org/mission/house-password/