edit to fix shortest prefix