자연수를 입력받으면 입력된 자연수의 자릿수 중 가장 많이 사용된 숫자를 출력하라.

int count[10];
int main(int argc, char** argv) {
	char a[100];
	int result = 0;
	int max = -2147000000;
//	freopen("input.txt", "rt", stdin);
	scanf("%s", &a);
	
	for(int i =0; i < a[i] != '\0'; ++i)
	{
		int digit = a[i] - '0';
		count[digit]++;
	}
	
	for(int i = 0;i <= 9; ++i)
	{
		if(max <= count[i])
		{
			max = count[i];
			result = i;
		}
	}

	cout << result << endl;

	return 0;
}