using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace palindrome
{
class Program
{
public static string ReverseString(string str)
{
if (str == null || str.Length <= 1)
{
return str;
}
StringBuilder revStr = new StringBuilder(str.Length);
for (int count = str.Length - 1; count > -1; count--)
{
revStr.Append(str[count]);
}
return revStr.ToString();
}
public static void Main()
{
string temp = "";
do
{
Console.WriteLine("Enter String");
temp = Console.ReadLine();
Console.WriteLine(ReverseString(temp));
}
while (temp != (ReverseString(temp)));
{
}
}
}
}
Walang komento:
Mag-post ng isang Komento