采用了滑动窗口

left作为左指针,i作为右指针,不断更新窗口,如果1窗口中的字符串出现在2中,则右指针向右移,不然则左指针向右移,

class Solution:
    def LCS(self , str1: str, str2: str) -> str:
        res=""
        left=0
        for i in range(len(str1)+1):
            if str1[left:i+1] in str2:
                res=str1[left:i+1]
            else:
                left=left+1
        return res

                    
                        
                
        # write code here