fork download
  1. #include <iostream>
  2. using namespace std;
  3. bool ifAllUnique(string str)
  4. {
  5. bool flag = true;
  6. char c;
  7. for(int i=0;i<str.length();i++)
  8. {
  9. for(int j=i+1;j<str.length();j++)
  10. {
  11. if(str[i] == str[j])
  12. {
  13. flag = false;
  14. return false;
  15. }
  16. }
  17. }
  18. return flag;
  19. }
  20. int main(int argc, char* argv[]) {
  21. // your code goes here
  22. string str;
  23. cout<<"enter string:";
  24. cin>>str;
  25. cout<<"The string is unique: "<<ifAllUnique(str);
  26. return 0;
  27. }
Success #stdin #stdout 0s 3464KB
stdin
world
stdout
enter string:The string is unique: 1