import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No");

  }
} import java.util.*; util.* java class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No");

  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No");

  } main {
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No");

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] c = sc.next().toCharArray(); c sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.sort(c) Arrays.sort Arrays c System.out.println(c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No") System.out.println System.out System System.out c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No" c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 c[0]-c[2] != 0 c[0]-c[2] c[0] c 0 c[2] c 2 0 c[0]-c[1]+c[2]-c[3] == 0 c[0]-c[1]+c[2]-c[3] c[0]-c[1]+c[2] c[0]-c[1] c[0] c 0 c[1] c 1 c[2] c 2 c[3] c 3 0 "Yes" "No" String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    char[] c = sc.next().toCharArray();
    Arrays.sort(c);
    System.out.println(c[0]-c[2] != 0 && c[0]-c[1]+c[2]-c[3] == 0 ? "Yes" : "No");

  }
}