利用栈和队列判断回文

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _404_栈和队列的应用
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            Stack stack = new Stack();
            Queue queue = new Queue();
            for(int i=0;i0)
            {
                if(stack.Pop()!=queue.Dequeue())
                {
                    IsHui = false;
                    break;
                }
            }
            Console.WriteLine("是否是回文:" + IsHui);
            Console.ReadKey();
        }
    }
}

你可能感兴趣的:(数据结构)