https://www.acmicpc.net/problem/1475
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int arr[]=new int[10];
int count=0;
String k=n+"";
for(int i=0;i<k.length();i++){
arr[n%10]++;
n/=10;
}
arr[6]+=arr[9];
arr[9]=0;
for(int i=0;i<10;i++){
int a=0;
if(i==6){
if(arr[i]%2==0) a=arr[i]/2;
else a=(arr[i]/2)+1;
}
else a=arr[i];
if(a>=count) count=a;
}
System.out.print(count);
}
}