You need to create an output vector the same size as the input vector. Then copy from location 6 of input to location 1 of output, location 7 of input to location 2 of output, location 8 of input to location 3 of output, and so on, until you reach the end of the input. Then copy location 1 of input to the 5th last output, location 2 of input to the 4th last output, and so on, until 5th location of input to the last output.
There is a way to do this all in one single loop with no if statements using a bit of clever mathematics. There is a way to do all this in one single loop with an if/else statement with no clever mathematics. There is a way to do it in two loops with no if statement.