Title description
Enter an int integer and return a new integer without repeating numbers in the reading order from right to left.
Enter description:
Enter an int integer
Output description:
According to the reading order from right to left, return a new integer without repeated numbers
Example 1
Input
9876673
Output
37689
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
string str = "";
for (int i = s.length() - 1; i >= 0; --i) {
if (str.find(s[i]) == string::npos)
str += s[i];
}
cout << str << endl;
return 0;
}