#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main()
{
//查出第一次只出现一次的字符
//思想是对于每个数统计一遍
char* str="aafdfeefm";
int length=strlen(str);
int total;
for(int i=0;i<length;i++)
{
total=0;
for(int j=0;j<length;j++)
{
if(total>1)break;
if(str[i]==str[j])total++;
}
if(total==1)
{
cout<<str[i]<<endl;
break;
}
}
return 0;
}
时间复杂度为O(N2) 效果不是很好,有非常大改进到O(n)的空间