CSharp · Console
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
Console.WriteLine($"Expected: True , Actual: {MustBeCharacter("stackoverflow?1234")}"); //Added question mark
Console.WriteLine($"Expected: False , Actual: {MustBeCharacter("stackoverflow1234")}"); //Missing special character i.e. ?
}
private static bool MustBeCharacter(string arg)
{
var specialChars = ".,?!*-+".ToCharArray();
return specialChars.Any(x => arg.Contains(x));
}
}