Naive Algorithm (All Occurrences)
Given two strings, P and T. Here, P is referred to as the pattern, and T is the text in which we will search for P using the naive search algorithm. This algorithm involves comparing P character by character with each substring of T that has the same length as P. The substrings of T are checked from left to right, and the characters within the strings are also compared from left to right.
Input Data
The first line of the input contains the pattern P (where (1 \leq \text{size}(P) \leq 100)), and the second line contains the text T (where (1 \leq \text{size}(T) \leq 100)).
Output Data
On the first line of the output, list all starting positions in T where the pattern P is found, separated by spaces. If P does not occur in T, output 0 on the first line.On the second line, provide the total number of character comparisons made during the search.Ensure that the format of the input and output data matches the provided example.