编辑代码

# coding:utf-8
#JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
#import numpy as np

def find_common_characters(strings):
    # 将第一个字符串转换为集合,作为起始点
    common_chars = set(strings[0])
    
    # 遍历剩余字符串
    for string in strings[1:]:
        # 将当前字符串转换为集合
        current_chars = set(string)
        # 取当前字符串的字符集合与之前所有字符串的字符集合的交集
        common_chars = common_chars.intersection(current_chars)
    
    return common_chars

# 示例字符串列表
my_strings = ["abcde", "defgh", "xyzabe"]

# 查找共同字符
result = find_common_characters(my_strings)

if len(result) > 0:
    print("在所有字符串中都出现的字符:", result)
else:
    print("没有在所有字符串中都出现的字符")