Solution by Juan Caballero
