Problem p03165 - Generation 2

Orig Description

Score : 100 points
Problem StatementYou are given strings s and t.
Find one longest string that is a subsequence of both s and t.
NotesA subsequence of a string x is the string obtained by removing zero or more characters from x and concatenating the remaining characters without changing the order.
Constraints
s and t are strings consisting of lowercase English letters.
1 \leq |s|, |t| \leq 3000
InputInput is given from Standard Input in the following format:
s
t
OutputPrint one longest string that is a subsequence of both s and t.
If there are multiple such strings, any of them will be accepted.
Sample Input 1axyb
abyxb
Sample Output 1axb
The answer is axb or ayb; either will be accepted.
Sample Input 2aa
xayaz
Sample Output 2aa
Sample Input 3a
z
Sample Output 3
The answer is  (an empty string).
Sample Input 4abracadabra
avadakedavra
Sample Output 4aaadara

Extracted Specification

An integer N (1 ≤ N ≤ 3000), representing the length of the first string.
An integer M (1 ≤ M ≤ 3000), representing the length of the second string.
A string S of length N, consisting of lowercase English letters.
A string T of length M, consisting of lowercase English letters.

### Example Input:

```
5
5
axyb
abyxb
```

### Function Signature:
Write a function f(N, M, S, T) that takes in the input.
```python
def f(N: int, M: int, S: str, T: str):
    '''
    N: an integer
    M: an integer
    S: a string
    T: a string
    '''
```

Test Case Generator

Sure, I'd be happy to help you with that! Here's a Python function to generate test cases for the problem statement you provided:

```python
import random
import string

def generate_test_case():
    # Constraints
    min_len = 1
    max_len = 3000
    
    # Generate random lengths for s and t within the constraints
    len_s = random.randint(min_len, max_len)
    len_t = random.randint(min_len, max_len)
    
    # Generate random strings s and t of the generated lengths
    s = ''.join(random.choices(string.ascii_lowercase, k=len_s))
    t = ''.join(random.choices(string.ascii_lowercase, k=len_t))
    
    return s, t

# Example usage
if __name__ == "__main__":
    test_case = generate_test_case()
    print("s:", test_case[0])
    print("t:", test_case[1])
```

This function generates random test cases for the given problem by creating two random strings `s` and `t` with lengths between 1 and 3000, inclusive. The characters in the strings are randomly chosen from the lowercase English alphabet.

Feel free to modify the code as per your needs or integrate it into your testing framework!

Extract Arguments

def extract_arguments(fh):
    s = fh.readline().strip()
    t = fh.readline().strip()
    return s, t