Shunting-Yard algorithm (napisany dla 4p)