def solve(self, cipher):
        S, p, q = cipher
        n = len(p)
        S = int(S)
        global_max = 0
        for i in xrange(n):  # only need to consider diagonal since scanned by diagonal line
            global_max = max(global_max, self.get_longest(S, p, q, i, 0), self.get_longest(S, p, q, 0, i))

        return global_max
Algorithm 0: brutal force
dataset/ETHPy150Open algorhythms/HackerRankAlgorithms/Substring Diff.py/Solution.solve