https://i.imgur.com/4FtpWBj.png
1-3行:定義function
5-6行:定義stack, 簡化呼叫pop
第7行:O(n)迴圈,注意是逆著迭代,
8-13行:簡化為一行stack.append,並依序判定採用f,g,h中哪個function,若皆否則為數字