大家来帮我用AI实现一个简单算法应用题,看看哪家效果最好

题目如下:

aaa  (10 usages found)
    bbb  (10 usages found)
        ccc  (10 usages found)
            ddd  (10 usages found)
                eee  (10 usages found)
                    fff  (8 usages found)
                        ggg
                            qqqqwqwqw.txt  (2 usages found)
                                9 "some text"
                            wwewewwew.txt  (2 usages found)
                                4 "some text"
                        ererereer.txt  (2 usages found)
                            59 "some text"
                    rtrtrtrtr.kt  (2 usages found)
                        3 "some text"
        hhh  (5 usages found)
            jjj  (2 usages found)
                tytyyttyty.txt  (1 usage found)
                    211 * "some text"
            kkk  (3 usages found)
                bfgbgfgbfg.txt  (1 usage found)
                    475 "some text"
                nghmgmhgmhhg.txt  (2 usages found)
                    619 "some text"
                    628 "some text"

以上带层级的文本中,每一行表示文件夹名称、文件名或行数。其中".txt"后缀结尾表示某个文件名,以数字开头的表示对应文件的指定行数。
现在你需要使用javascript实现将所有的.txt文件全路径以及行数输出,输出示例如下:
aaa/bbb/ccc/hhh/kkk/nghmgmhgmhhg.txt: 619,628
注:请忽略"(x usages found)"子串,因为是个干扰项,其中x指代任意数字。

题目来源我今天碰到的一个实际应用场景,一开始尝试用GPT4-o然后以失败告终 :tieba_025:,而且是怎么教都教不对。
看看大家的AI咋样 :face_with_peeking_eye:
大伙记得别直接复制AI的回答来回复,不然会被自动举报的 :smiling_face_with_tear:

你跑下就知道了,AI能直接答对,但是算法是错的 :joy:

1 Like

哎呀这啥呀。。 :bili_001: