}//method

        public static String toPostfix(String cad)
        {
            String         res  = "";
            LkStack <char> pila = new LkStack <char>();
            char           c;

            for (int i = 0; i < cad.Length; i++)
            {
                c = cad.ElementAt(i);
                if (char.IsLetterOrDigit(c) || c == '.')
                {
                    res += c;
                }
                else
                {
                    if (res.Length >= 1)
                    {
                        if (res.ElementAt(res.Length - 1) != ' ')
                        {
                            res += " ";
                        }
                    }
                    if (c == '(')
                    {
                        pila.push(c);
                    }
                    else
                    {
                        if (c == ')')
                        {
                            while (!pila.isEmpty() && pila.peek() != '(')
                            {
                                res += pila.pop() + " ";
                            }
                            if (!pila.isEmpty() && pila.peek() == '(')
                            {
                                pila.pop();
                            }
                        }
                        else
                        {
                            while (!pila.isEmpty() && jerarquia(c) <= jerarquia(pila.peek()))
                            {
                                res += pila.pop() + " ";
                            }
                            pila.push(c);
                        }
                    }
                }
            }
            res += " ";
            while (!pila.isEmpty())
            {
                res += pila.pop() + " ";
            }
            return(res);
        }//method
        }//method

        public static LkStack <string> stringPila(String cadena)
        {
            String[] aux;
            Boolean  ayuda;

            ayuda = true;
            LkStack <string> pila;
            int i;

            i = 0;
            while (i < cadena.Length && ayuda)
            {
                if (cadena.ElementAt(i) == '+' || cadena.ElementAt(i) == '-' || cadena.ElementAt(i) == '*' || cadena.ElementAt(i) == '/')
                {
                    ayuda = false;
                }
                i++;
            }
            pila = new LkStack <string>();
            if (ayuda)
            {
                pila.push(cadena);
                Console.WriteLine(pila.peek());
            }

            else
            {
                aux = cadena.Split(' ');
                for (i = aux.Length - 1; i >= 0; i--)
                {
                    switch (aux[i])
                    {
                    case "-":
                        pila.push("-");
                        break;

                    case "+":
                        pila.push("+");
                        break;

                    case "*":
                        pila.push("*");
                        break;

                    case "/":
                        pila.push("/");
                        break;

                    default:
                        pila.push(aux[i]);
                        break;
                    } //switch
                }     //for
            }         //else
            return(pila);
        }             //method
        }//method

        public static double resuelvePf(LkStack <string> expresion)
        {
            double           resp, aux1, aux2;
            char             oper;
            LkStack <string> pila = new LkStack <string>();

            resp = Convert.ToDouble(expresion.peek());
            while (!expresion.isEmpty())
            {
                try {
                    Convert.ToDouble(expresion.peek());
                    pila.push(expresion.pop());
                }
                catch
                {
                    aux1 = Convert.ToDouble(pila.pop());
                    aux2 = Convert.ToDouble(pila.pop());
                    oper = (expresion.pop().ElementAt(0));
                    switch (oper)
                    {
                    case '+':
                        resp = aux2 + aux1;
                        break;

                    case '-':
                        resp = aux2 - aux1;
                        break;

                    case '*':
                        resp = aux2 * aux1;
                        break;

                    case '/':
                        resp = aux2 / aux1;
                        break;
                    }
                    string t = "" + resp;
                    pila.push(t);
                }
            }
            return(resp);
        }//method