using System.Collections.Generic;
static void RepeatPatternLst(string SearchString, int PatternLength)
int StringLength = SearchString.Length;
var Pattern = new List<string>();
var PatternCnt = new List<int>();
if ( PatternLength > 0 && PatternLength < StringLength )
while ( StringPosition <= ( StringLength - PatternLength ) )
PatternCurrent = SearchString.Substring(StringPosition, PatternLength);
PatternArrayIndex = Pattern.IndexOf(PatternCurrent);
if ( PatternArrayIndex == -1 )
Pattern.Add(PatternCurrent);
PatternCnt[PatternArrayIndex]++;
for (int i = 0; i < PatternCnt.Count; i++)
Console.WriteLine("Repeated Pattern: " + Pattern[i] + " Pattern Count: " + PatternCnt[i].ToString());
public static void Main()
RepeatPatternLst("zf3kabxcde224lkzf3mabxc51+crsdtzf3nab=", 3);