Advertisement
Neveles

Untitled

Oct 23rd, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstring>
  4.  
  5. using namespace std;
  6.  
  7. string newUniqueStr(string str)
  8. {
  9. int arr[255] = { 0 };
  10. for (int i = 0; i < str.size(); ++i)
  11. ++arr[static_cast<int>(str[i])];
  12.  
  13. string newStr = "";
  14.  
  15. for (int i = 0; i < 255; ++i)
  16. if (arr[i] == 1)
  17. newStr += static_cast<char>(i);
  18. return newStr;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement