Count of number of given string in 2D character array
Sun Apr 07 2024
findString:
A function meticulously designed to traverse the 2D array, scrutinizing each character as a potential starting point for the given string. By considering horizontal (both left and right) and vertical (both up and down) orientations, the method comprehensively searches for matching sequences. It employs a nested loop structure, first to navigate through the array's rows and columns, and then to compare subsequent characters in the potential matching direction with the string's characters. When a full match is identified, the count is incremented, reflecting the presence of the string in that orientation.