题解 | #删除字符串中出现次数最少的字符#
删除字符串中出现次数最少的字符
http://www.nowcoder.com/practice/05182d328eb848dda7fdd5e029a56da9
// 18.26- #include <stdio.h> #include <string.h> int main(void){ char str[20]; char* p; int letter[26]; while(scanf("%s",&str)!=EOF){ int min=20; p=str; memset(letter,0,sizeof(letter)); while(*p!='\0'){ letter[*p-'a']++; p++; } for(int i=0;i<26;i++){ if(letter[i]<min&&letter[i]!=0) min=letter[i]; } p=str; while(*p!='\0'){ if(letter[*p-'a']>min){ printf("%c",*p); } p++; } printf("\n"); } }