#include#includeusing namespace std;void getonce (char *str){int hash[256] ={0};int k=0;char *order=(char *)malloc(strlen(str)+1);while(*str != '\0'){hash[int(*str)]++;if (hash[int(*str)] == 1)order[k++] = *str;str++;}order[k] = '\0';k=0;while(order[k]!='\0'){if(hash[int(order[k])] == 1)cout<<order[k]<<endl;k++;}}int main(){ char *s="abdfdfacef";getonce(s);return 0;}
输出字符串中只出现一次的字符
最新推荐文章于 2021-02-15 23:12:59 发布