Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool unique ( string s ) { sort ( s . begin ( ) , s . end ( ) ) ; for ( int i = 0 ; i < s . size ( ) ; i ++ ) { if ( s [ i ] == s [ i + 1 ] ) { return false ; break ; } } return true ; } int main ( ) { if ( unique ( " abcdd " ) == true ) { cout << " String ▁ is ▁ Unique " << endl ; } else { cout << " String ▁ is ▁ not ▁ Unique " << endl ; } return 0 ; }