求助!!面试题:找出相似结构的字符串
问题:N个字符串,例如字符串earnestnessbiophysicalohax和agekestnessbiophysicalohax规则是前四位字符不同,后面字符相同
找出所有这种结构的相似字符串并输出。
输入:
[earnestnessbiophysicalohax
,agekestnessbiophysicalohax
,hjbtestnessbiophysicalohax
,0defd57ebfef34be
,ztix4c82bcf6b01
,a8004c82bcf6b01
,werk4c82bcf6b01
,ddb2a7a2e3c603cc14
,ddb2a7a2e37ebf7ebfq]
,agekestnessbiophysicalohax
,hjbtestnessbiophysicalohax
,0defd57ebfef34be
,ztix4c82bcf6b01
,a8004c82bcf6b01
,werk4c82bcf6b01
,ddb2a7a2e3c603cc14
,ddb2a7a2e37ebf7ebfq]
输出:
[earnestnessbiophysicalohax
,agekestnessbiophysicalohax
,hjbtestnessbiophysicalohax
,a8004c82bcf6b01
,werk4c82bcf6b01]
,agekestnessbiophysicalohax
,hjbtestnessbiophysicalohax
,a8004c82bcf6b01
,werk4c82bcf6b01]
哪位大佬可以帮忙解答下,感谢(最好用Python,java也可以)。