}//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 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