st
.c
in the string s
.
c
is a non-star character, push c
onto st
.c
is a star, pop the top character from st
.result
.st
is not empty, pop characters from st
and prepend them to result
.result
as the final string after all stars have been processed.