392. 判断子序列




class Solution(object):
    def isSubsequence(self, s, t):
        """
        :type s: str
        :type t: str
        :rtype: bool
        """
        if len(s) > len(t):
            return False
        elif len(s) == len(t):
            if s != t:
                return False
        for ch in s:
            if ch not in t:
                return False
            if ch in t:
                t = t[t.index(ch)+1:]
        return True
原文地址:https://www.cnblogs.com/panweiwei/p/13065242.html