Having problems in infix to prefix, after forloop code breaks with example