You need something pointing to an element in the input. After printing that element change to point to the next element. If past the end, point to the first again.
You could use pointer or index. With an index one can also make use of the operator %.