标签:
//如输入 abaccdeff,则输出 b void PrintFirstOneAppearOnce(char* strString) { int nTime[26]; memset(nTime, 0, sizeof(nTime)); for (int i = 0; i < strlen(strString); i++) { int nNumber = strString[i] - 'a'; nTime[nNumber] ++; } for (int i = 0; i < strlen(strString); i++) { int nNumber = strString[i] - 'a'; if(nTime[nNumber] == 1) { cout << "result:" << strString[i] << endl; return; } } cout << "result:not find" << endl; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/king__moving/article/details/48031607