알고리즘/백준 BOJ

[BOJ C#] 1259 팰린드롬수

왹져박사 2023. 1. 26. 22:35

using System;
using System.Linq;
using System.Text;
using System.IO;

namespace _1259
{
    class Program
    {
        static void Main()
        {
            StreamReader sr = new StreamReader(Console.OpenStandardInput());
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
            StringBuilder sb = new StringBuilder();


            while (true)
            {
                string str = sr.ReadLine();
                if (str == "0")
                    break;
                string strReverse = new string(str.Reverse().ToArray());
                if (str == strReverse)
                    sb.Append("yes\n");
                else
                    sb.Append("no\n");
            }
            sw.WriteLine(sb);

            sr.Close();
            sw.Flush();
            sw.Close();
        }
    }
}