Alternative Way

I don't expect the array method to work properly, so I made this.
Instead of arrays, it uses if statements to print distance.