using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace number
{
class Program
{
static void Main(string[] args)
{
//等待用戶輸入字符串
Console.WriteLine("請輸入一串字符串");
string str = Console.ReadLine();
int j = str.Length;
char[] a = new char[j];
for (int i = 0; i < j; i++)
{
a[i] = Convert.ToChar(str.Substring(i, 1));
}
int[] count = new int[10];
for (int k = 0; k < j; k++)
{
switch (a[k])
{
case '0':
count[0]++;
break;
case '1':
count[1]++;
break;
case '2':
count[2]++;
break;
case '3':
count[3]++;
break;
case '4':
count[4]++;
break;
case '5':
count[5]++;
break;
case '6':
count[6]++;
break;
case '7':
count[7]++;
break;
case '8':
count[8]++;
break;
case '9':
count[9]++;
break;
}
}
for (int i = 0; i < count.Length; i++)
{
Console.WriteLine("{0}的個數爲{1}",i,count[i]);
}
}
}
}