gamerspyweb
BAN USERusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Factorial
{
class Program
{
static void Main(string[] args)
{
char[] str;
string _str = "";
Console.WriteLine("Please enter a string to check Paladin");
str = Console.ReadLine().ToCharArray();
{
if (str.Length == 3)
{
if (ifPaladine(str, 0, str.Length - 1))
{
Console.WriteLine("It Is Paladine");
Console.ReadKey();
}
else
{
Console.WriteLine("Not a paladine");
Console.ReadKey();
}
}
else if (str.Length < 3)
{
Console.WriteLine("Invalid input");
return;
}
else if (str.Length > 3)
{
string result = "";
for (int x = 0; x < str.Length - 3; x++)
{
for (int y = x + 3; y <= str.Length; y++)
{
for (int z = x; z < y; z++)
{
_str = _str + str[z];
}
if (ifPaladine(_str.ToCharArray(), 0, _str.Length - 1))
{
result = result + " " + _str;
_str = "";
}
else
_str = "";
}
}
if (result.Equals(String.Empty))
Console.WriteLine("No Paladin found");
else
Console.WriteLine(result.ToString());
Console.ReadKey();
}
}
}
public static void printString(string[] str)
{
for (int i = 0; i < str.Length; i++)
{
Console.WriteLine(String.IsNullOrEmpty(str[i].ToString()));
}
}
public static Boolean ifPaladine(char[] ar, int start, int end)
{
string reverse = "";
for (int i = ar.Length-1; i >=0; i--)
{
reverse = reverse + ar[i];
}
string c = new string(ar);
if (c.ToLower() == reverse.ToString().ToLower())
return true;
else
return false;
} } }
using System;
- gamerspyweb January 21, 2018using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Factorial
{
class Program
{
static void Main(string[] args)
{
char[] str;
string _str = "";
Console.WriteLine("Please enter a string to check Paladin");
str = Console.ReadLine().ToCharArray();
{
if (str.Length == 3)
{
if (ifPaladine(str, 0, str.Length - 1))
{
Console.WriteLine("It Is Paladine");
Console.ReadKey();
}
else
{
Console.WriteLine("Not a paladine");
Console.ReadKey();
}
}
else if (str.Length < 3)
{
Console.WriteLine("Invalid input");
return;
}
else if (str.Length > 3)
{
string result = "";
for (int x = 0; x < str.Length - 3; x++)
{
for (int y = x + 3; y <= str.Length; y++)
{
for (int z = x; z < y; z++)
{
_str = _str + str[z];
}
if (ifPaladine(_str.ToCharArray(), 0, _str.Length - 1))
{
result = result + " " + _str;
_str = "";
}
else
_str = "";
}
}
if (result.Equals(String.Empty))
Console.WriteLine("No Paladin found");
else
Console.WriteLine(result.ToString());
Console.ReadKey();
}
}
}
public static void printString(string[] str)
{
for (int i = 0; i < str.Length; i++)
{
Console.WriteLine(String.IsNullOrEmpty(str[i].ToString()));
}
}
public static Boolean ifPaladine(char[] ar, int start, int end)
{
string reverse = "";
for (int i = ar.Length-1; i >=0; i--)
{
reverse = reverse + ar[i];
}
string c = new string(ar);
if (c.ToLower() == reverse.ToString().ToLower())
return true;
else
return false;
}
}
}