The pancake problem is concerned with sorting a permutation (a stack of pancakes of different diameter) using only prefix reversals (spatula flips). Although the problem description belies simplicity, an exact formula for the maximum number of flips needed to sort $n$ pancakes has been elusive. In this paper we present a different approach to the pancake problem, as a word problem on the symmetric group and hyperoctahedral group. Pancake flips are considered as generators and we study the relations satisfied by them. We completely describe the order of the product of any two of these generators, and provide some partial results on the order of the product of any three generators. Connections to the pancake graph of the hyperoctahedral group are also drawn.