#include<iostream>
#include<deque>
using namespace std;
char* firstNotRepeatingChar(char *str){
//在一个字符串中找到第一个只出现一次的字符。如输入abaccdeff,则输出b。
if(!str)
return NULL;
int count[256];
char *pCur=str;
for(int i=0;i<256;i++)
count[i]=0;
while (*pCur!='\0')
{
count[*pCur]++;
pCur++;
}
pCur=str;
while (*pCur!='\0')
{
if(count[*pCur]==1)
{
cout<<*pCur;
return pCur;
}
pCur++;
}
return NULL;
}
int main(){
char *str="dfsfsfsaasdfafljlsdsefk";
char *ch=firstNotRepeatingChar(str);
return 0;
}
#include<deque>
using namespace std;
char* firstNotRepeatingChar(char *str){
//在一个字符串中找到第一个只出现一次的字符。如输入abaccdeff,则输出b。
if(!str)
return NULL;
int count[256];
char *pCur=str;
for(int i=0;i<256;i++)
count[i]=0;
while (*pCur!='\0')
{
count[*pCur]++;
pCur++;
}
pCur=str;
while (*pCur!='\0')
{
if(count[*pCur]==1)
{
cout<<*pCur;
return pCur;
}
pCur++;
}
return NULL;
}
int main(){
char *str="dfsfsfsaasdfafljlsdsefk";
char *ch=firstNotRepeatingChar(str);
return 0;
}