import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  } main {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  } Scanner sc = new Scanner(System.in) ; sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc int[] count = new int[4]; count new int[4] 4 int OK =0; OK 0 for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    } int i =0; int i =0; i 0 i<4 i 4 i++ i++ i {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    } {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    } for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      } int j =0; int j =0; j 0 j<4 j 4 j++ j++ j {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      } {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      } if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        } S.charAt(i) == S.charAt(j) S.charAt(i) S.charAt S i S.charAt(j) S.charAt S j {
          count[i]++;
        } count[i]++ count[i] count i for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    } {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    } if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } count[i] != 2 count[i] count i 2 {
        System.out.println("No");
        OK++;
        break;
      } System.out.println("No") System.out.println System.out System System.out "No" OK++ OK break; if (OK ==0) System.out.println("Yes"); OK ==0 OK 0 System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in) ;
    String S = sc.next();
    int[] count = new int[4];
    int OK =0;
    for (int i =0; i<4; i++) {
      for (int j =0; j<4; j++) {
        if (S.charAt(i) == S.charAt(j)) {
          count[i]++;
        }
      }
    }
    for (int i=0; i<4; i++) {
      if (count[i] != 2) {
        System.out.println("No");
        OK++;
        break;
      } 
    }  
    if (OK ==0) System.out.println("Yes");
  }
}