为什么最后一个测试点错了

img

#include <iostream>
#include <string>
using namespace std;
struct number
{
    string name;
    int count;
};
int main()
{
    number ber[10] = { "0",0,"1",0,"2",0,"3",0, "4",0, "5",0, "6",0, "7",0, "8",0, "9",0 };
    int num,a[1000],t=0;
    cin >> num;
    while (num)
    {
        a[t++] = num % 10;
        num = num / 10;
    }
    for (int i = t - 1; i >= 0; i--)
    {
        if (a[i] == 0)ber[0].count++;
        else if (a[i] == 1)ber[1].count++;
        else if (a[i] == 2)ber[2].count++;
        else if (a[i] == 3)ber[3].count++;
        else if (a[i] == 4)ber[4].count++;
        else if (a[i] == 5)ber[5].count++;
        else if (a[i] == 6)ber[6].count++;
        else if (a[i] == 7)ber[7].count++;
        else if (a[i] == 8)ber[8].count++;
        else if (a[i] == 9)ber[9].count++;
    }
    for (int j = 0; j < 10; j++)
    {
        if(ber[j].count!=0)
            cout << ber[j].name << ":" << ber[j].count << endl;
    }
    return 0;
}

img