Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- std::vector<std::string> fileNaming(std::vector<std::string> names) {
- set<string> mp;
- vector<string> ans;
- for(string s:names){
- int t = 0;
- string ss = s;
- while(mp.find(ss)!=mp.end())
- ss = s +"("+to_string(++t)+")";
- mp.insert(ss);
- ans.push_back(ss);
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement