c 输入一串字符串,倒序并去重输出,例如:hello world€$ 输出:$€dlrow eh

c++程序

#include<iostream>
using namespace std;
int main()
{char s[200],*p=s;
 int a[128]={0};
 gets(s);
 for(;*p;p++);
 for(--p;p>=s;p--)
   if(!a[*p])
   {a[*p]=1;
    cout<<*p;
   }
 cout<<endl;
 return 0;  
}
温馨提示:答案为网友推荐,仅供参考
相似回答