import java.util.*;

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

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