one way of solving this bastard in zsh
also here's another way