#include "stdafx.h" void find(char * str, size_t len) { int count[256] = {0}; for(int i=0;i<len;i++) count[str[i]-'\0']++; for(int i=0;i<len;i++) if(count[str[i]-'\0']==1) { printf("%c\n",str[i]); return; } } int _tmain(int argc, _TCHAR* argv[]) { find("aabcc",5); return 0; }