Rename the files such that no two files have the same name.
UnsolvedYou are given an string of desired filenames in the order of their creation. Since two files cannot have equal names, the one which comes later will have an addition to its name in a form of (k), where k is the smallest positive integer such that the obtained name is not used yet.
Input: "doc(3), doc(4), doc, doc, doc, doc, doc (6), (image ), hello world, helloworld, (image )(1), (image )" doc -> doc doc -> doc(1) # as there is doc already image -> image doc(1) -> doc(1)(1) # as doc(1) is already there doc -> doc(2) # as doc and doc(1) are already there Output: "doc(3), doc(4), doc, doc(1), doc(2), doc(5), doc (6), (image ), hello world, helloworld, (image )(1), (image )(2)"
value1
Single string separated by commas.
Sample Input 1
value1: doc(3), doc(4), doc, doc, doc, doc, doc (6), (image ), hello world, helloworld, (image )(1), (image ) output: doc(3), doc(4), doc, doc(1), doc(2), doc(5), doc (6), (image ), hello world, helloworld, (image )(1), (image )(2)