I have two questions and I don't know whether it can be solved using Maple. The first question is that I have a text file, the data of which has been sorted using Unix procedure SORT. Since the data has been sorted, we just need to compare consecutive lines. Our aim is to count the total number of the same lines of this file and obtain the maximum number of the same consecutive lines. For example, the data of the file, named file.txt, is:
I want to get two numbers: the total number of the same lines 5 and the maximum number of the same consecutive lines 3. Another question is, given a string s, if s is not contained in this file, then the program returns NULL;otherwise, the program returns the total number it appears and the specific line numbers it appears. For instance, suppose the string is s=1,0,5,-4,4,0, then it returns the total number 3 and the line numbers 4,5,6.