题解 | #数据分类处理#

数据分类处理

https://www.nowcoder.com/practice/9a763ed59c7243bd8ab706b2da52b7fd

while True:
    try:
        x=list(map(int,input().split()))
        x1=x[0]
        x2=x[1:]
        y=list(map(int,input().split()))
        y1=y[0]
        y2=y[1:]
        y3=sorted(list(set(y2)))
        d=[]
        for i in range(len(y3)):
            a=y3[i]
            b=0
            c=[]
            for j in range(len(x2)):
                if str(y3[i]) in str(x2[j]):
                    c.append(j)
                    c.append(x2[j])
                    b+=1
                    
            if b!=0:
                d.append(a)
                d.append(b)
                d=d+c
        print(" ".join(list(map(str,[len(d)]+d))))
    except:
        break



全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务