#include <stdio.h> #include <string.h> #define max 1000 //2021/7/3-16:07 //2021/7/3-16:21 /* 输入:9876673 输出:37689 */ int main() { char s[max]; char a[32]; char v[32]; int i, j; gets(s); memset(a, 0, 32); for (i = strlen(s) - 1, j = 0; i >= 0; i--) { if (a[s[i] - '0'] == 0) { v[j++] = s[i]; a[s[i] - '0'] = 1; } } v[j] = 0; puts(v); return 0; }