#include <stdio.h>

int main() {
    // 0-8 6이랑 9는 같은 취급함
    int num[9]={0};
    int n,r,max=0;
    scanf("%d",&n);
    //첫째자리수부터 입력
    while(n!=0) {
        r=n%10;
        n=n/10;
        //9랑 6은 같은 취급
        if(r==9) r=6;
        //숫자 카운트
        num[r]+=1;
    }
    //6==9니까 짝수면 절반 홀수면 절반 + 1(3이면 2세트 필요하긴 때문)
    // count[6] = (count[6] + count[9] + 1) / 2; 더 좋은 표현인듯
    if(num[6]%2==0) num[6]=num[6]/2;
    else num[6]=num[6]/2+1;
    //최댓값 찾기
    for (int i=0; i<9; i++) {
        if (max<=num[i]) max=num[i];
    }
    printf("%d",max);
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: