public static void Main()
Console.WriteLine("Enter Input String");
var i_string = Console.ReadLine();
Console.WriteLine("Enter pattern length: ");
int p_Length = int.Parse(Console.ReadLine());
if (i_string.Length < p_Length)
Console.WriteLine("Input string characters must be greater than search pattern Length");
for (int a = 0; a<i_string.Length-p_Length; a++)
var sub_string = i_string.Substring(a, p_Length);
if (i_string.Contains(sub_string))
int b = sub_string.Length;
for (int i = 0; i <= c - b; i++)
if (i_string[i + j] != sub_string[j])
Console.WriteLine("Pattern " + sub_string + " With an occurence value of " + counter);
Console.WriteLine("No substring with given length" + p_Length + " found");