the histogram should be sent to a file with the same name as the input one, but with the suffix '.hist' (it should be concatenated to the original name) ...
As you already know, a stack is a data structure realizing the so-called LIFO (Last In - First Out) model. It's easy and you've already grown perfectly accustomed to it. Let's taste something new now.