![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
static void ReturnShowCOunt(string inputStr)
{
if (string.IsNullOrEmpty(inputStr))
throw new ArgumentNullException("inputStr");
for (int i = 0; i < inputStr.Length; i++)
{
int flag = 0;
int count = 1;
for (int j = 0; j < i; j++)
{
if (inputStr[i] == inputStr[j])
{
flag = 1;
break;
}
}
if (flag == 1)
continue;
for (int k = i + 1; k < inputStr.Length; k++)
{
if (inputStr[i] == inputStr[k])
count++;
}
Console.WriteLine("{0}:{1}", inputStr[i], count);
}
}
{
if (string.IsNullOrEmpty(inputStr))
throw new ArgumentNullException("inputStr");
for (int i = 0; i < inputStr.Length; i++)
{
int flag = 0;
int count = 1;
for (int j = 0; j < i; j++)
{
if (inputStr[i] == inputStr[j])
{
flag = 1;
break;
}
}
if (flag == 1)
continue;
for (int k = i + 1; k < inputStr.Length; k++)
{
if (inputStr[i] == inputStr[k])
count++;
}
Console.WriteLine("{0}:{1}", inputStr[i], count);
}
}