using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
public static void Main()
string fullName = "H I D A Y A T";
fullName = correctingFullName(fullName);
fullName = Regex.Replace(fullName.Trim(), "[^a-zA-Z0-9% ._]", string.Empty);
Console.WriteLine("fullName 1: " + fullName);
fullName = System.Text.RegularExpressions.Regex.Replace(fullName, @"\s+", " ");
Console.WriteLine("fullName 2: " + fullName);
string strOne = fullName.Replace(" ", ",");
Console.WriteLine("strOne : " + strOne);
string[] strArrayOne = new string[]{""};
strArrayOne = strOne.Split(',');
string stringToCheck = "sess1on1";
string password = "sess1on1";
stringToCheck = stringToCheck.ToUpper();
bool isContainFullName = false;
foreach (string x in strArrayOne)
if (stringToCheck.Contains(x))
isContainFullName = true;
Console.WriteLine("fullName : " + fullName);
if (fullName == "" || fullName == " ")
isContainFullName = false;
var hasSymbol = new Regex(@"^((?=.*\d.*\d)(?=.*[A-Za-z]).{8,12})$");
var isValidatedPass = hasSymbol.IsMatch(password);
Console.WriteLine("isValidatedPass : " + isValidatedPass);
Console.WriteLine("isContainFullName : " + isContainFullName);
if ((isValidatedPass == false && isContainFullName == true) || (isValidatedPass == false && isContainFullName == false) || (isValidatedPass == true && isContainFullName == true))
Console.WriteLine("Wrong Combination");
Console.WriteLine("Correct Combination");
public static string correctingFullName(string fullname)
var splitSpace = fullname.Split(' ');
for(var i = 0; i < splitSpace.Length-1 ; i++){
if (splitSpace[i].Length == 1) {
if (splitSpace[i + 1].Length == 1) {
newText += splitSpace[i] + splitSpace[i + 1];
newText += splitSpace[i] + " " + splitSpace[i + 1];
if (splitSpace[i].Length == 1) {
if (splitSpace[i + 1].Length == 1) {
newText += splitSpace[i + 1];
} else if (splitSpace[i - 1].Length == 1) {
newText += splitSpace[i + 1].Length > 1 ? " " + splitSpace[i + 1] : splitSpace[i + 1];
newText += " " + splitSpace[i + 1];
newText += " " + splitSpace[i + 1];