def longest_prefix_suffix_match(A, B, Q, queries): """ Computes the length of the longest prefix of A that matches a suffix of B for each query. Parameters: A (str): The first string. B (str): The second string. Q (int): The number of queries. queries (list of tuples): The list of queries, each represented as a tuple (P, S). Returns: list of list of int: The list of results for each test case, where each result is a list of integers representing the lengths of the longest prefix-suffix matches for each query. """ n = len(B) suffix_array = sorted(range(n), key=lambda i: B[i:]) LCP = [0] * n for i in range(1, n): j = suffix_array[i] k = suffix_array[i-1] while j <