Print all distinct characters of a string in order ( 3 Methods ) |  ; checking if two charactors are equal
#include <bits/stdc++.h> NEW_LINE using namespace std ; int main ( ) { string str = " GeeksforGeeks " ; for ( int i = 0 ; i < str . size ( ) ; i ++ ) { int flag = 0 ; for ( int j = 0 ; j < str . size ( ) ; j ++ ) { if ( str [ i ] == str [ j ] and i != j ) { flag = 1 ; break ; } } if ( flag == 0 ) cout << str [ i ] ; } return 0 ; }