if __name__ == '__main__': str1 = input('请输入一个字符串: ') str2 = input('请输入一个子串: ') ncount = str1.count(str2) print(ncount)