//ex1_function2.cpp
// 源作者:曹玲玲 编于2012-09-12
//【题目】华为2013校园招聘机试题目题4:删除一个字符串中出现次数最少的字符,函数原型为:char * delChar(char *s,int iLen)
//【输入】s为输入字符串,iLen为输入字符串长度
// 如输入字符串为“abcdd”,输出为"dd"
// 字符串中只有小写字母,不含空格且字符串最大长度不超过20
#include <stdio.h>
#include <stdlib.h>
#define MAX 20
//判断字符S是否在字符串visit中,是返回位置,不是返回-1
int whetherInVisit(char s,char* visit)
{
int i=0;
while(visit[i]!='\0')
{
if (visit[i]==s)
return i;
else
i++;
}
return -1;
}
//判断数i,是否是数组array中的最小数,是返回1,不是返回0
int whetherIsMini(unsigned int i,unsigned int * array,unsigned int aLen)
{
unsigned int temp=0;
for(temp=0;temp<aLen;temp++)
{
if (i>array[temp])
return 0;
}
return 1;
}
char* delChar(char *s,int iLen)
{
unsigned int Count[MAX];//存放各字符出现的次数
char v