import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  } main {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = a; b a String n; n int len; len int lenans = 4; lenans 4 int i = 0; i 0 n = String.valueOf(i) n String.valueOf(i) String.valueOf String i b = a.replace(n,"") b a.replace(n,"") a.replace a n "" len = b.length() len b.length() b.length b if(len < lenans){
        lenans = len;
      } len < lenans len lenans {
        lenans = len;
      } lenans = len lenans len b = a b a System.out.println(lenans) System.out.println System.out System System.out lenans String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  }
} Main
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  }
}
