Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Print reverese string non repeated chars
//Title of this code #include <iostream> #include <string> using namespace std; void setFlag(char c, int& n) { int i = c - 'a'; n |= 1 << i; } bool getFlag(char c, int n) { int i = c - 'a'; return n & (1 << i); } void printReverseString(const string& s) { int n = 0; for (int i = s.length() - 1; i >= 0; --i) { if (!getFlag(s[i], n)) { cout << s[i]; setFlag(s[i], n); } } cout << endl; } int main() { printReverseString("abbcaad"); }
run
|
edit
|
history
|
help
0
LIS
sdfg
inversion of array using merge sort
asa
Hello World C++ - minimal
Programa 3(Creo que ya esta)
Fungsi dan for
Lex cpp
StackListHi
hack qus