import java.util.*;
import java.util.stream.*;

public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} import java.util.*; util.* java import java.util.stream.*; stream.* java.util public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } main {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) char[] S = in.nextLine().toCharArray(); S in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in Arrays.sort(S) Arrays.sort Arrays S if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } S[0] == S[1] && S[1] != S[2] && S[2] == S[3] S[0] == S[1] && S[1] != S[2] && S[2] == S[3] S[0] == S[1] S[0] S 0 S[1] S 1 S[1] != S[2] S[1] S 1 S[2] S 2 S[2] == S[3] S[2] S 2 S[3] S 3 {
      System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
      System.out.println("No");
    } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main
import java.util.*;
import java.util.stream.*;

public class Main {

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    char[] S = in.nextLine().toCharArray();
    Arrays.sort(S);
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
