Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. std::vector<std::string> fileNaming(std::vector<std::string> names) {
  2.     set<string> mp;
  3.     vector<string> ans;
  4.     for(string s:names){
  5.         int t = 0;
  6.         string ss = s;
  7.         while(mp.find(ss)!=mp.end())
  8.             ss = s +"("+to_string(++t)+")";
  9.         mp.insert(ss);
  10.         ans.push_back(ss);
  11.     }
  12.     return ans;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement