不读取txt文件中的空白(堆栈)

enter image description here -txt file

enter image description here program looks like

我的程序准确地读取了他在txt文件中得到的内容,但是他没有读取空白,单词粘在一起。有人能帮我解决这个问题,因为我不知道。

    void zad2(){


    element* stack = nullptr;

    ifstream task("stos.txt", ifstream::in);
    if (!task.is_open()) {
        cout << "Blad otwarca pliku!" << endl;
        return /*EXIT_FAILURE*/;
    }
    char znak;
    bool pushing;
    while(task >> znak)
    {
        if (pushing) {
            push2(stack, znak);
            pushing = false;
        } else {
            switch (znak) {
                case '<':
                    pushing = true;
                    break;
                case '>':
                    pop(stack);
                    break;
                case '|':
                    p5(stack);
                    cout << endl;
                    break;
                default: break;
            }
        }
    }
    cout << endl;

    }