The pancake problem

Help the poor psychorigid pancakes' chef to sort its pancake stack!

This funny problem leads to algorithms that are somewhat more challenging to implement. You are supposed to master the bases of programming and some sorting algorithms to take this lesson.