import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  } main {
    Scanner scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] S = scanner.nextLine().toCharArray(); S scanner.nextLine().toCharArray() scanner.nextLine().toCharArray scanner.nextLine() scanner.nextLine scanner HashMap<Character, Integer> map = new HashMap<Character, Integer>(); map new HashMap<Character, Integer>() for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    } {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    } if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      } map.containsKey(S[i]) map.containsKey map S[i] S i {
        map.put(S[i], map.get(S[i]) + 1);
      } map.put(S[i], map.get(S[i]) + 1) map.put map S[i] S i map.get(S[i]) + 1 map.get(S[i]) map.get map S[i] S i 1 {
        map.put(S[i], 1);
      } map.put(S[i], 1) map.put map S[i] S i 1 boolean isFiftyFifty = true; isFiftyFifty true for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    } char key map.keySet() map.keySet map {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    } {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    } if (map.get(key) != 2) {
        isFiftyFifty = false;
      } map.get(key) != 2 map.get(key) map.get map key 2 {
        isFiftyFifty = false;
      } isFiftyFifty = false isFiftyFifty false if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } isFiftyFifty {
      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 scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
} public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] S = scanner.nextLine().toCharArray();

    HashMap<Character, Integer> map = new HashMap<Character, Integer>();
    for (int i = 0; i < 4; i++) {
      if (map.containsKey(S[i])) {
        map.put(S[i], map.get(S[i]) + 1);
      } else {
        map.put(S[i], 1);
      }
    }

    boolean isFiftyFifty = true;
    for (char key : map.keySet()) {
      if (map.get(key) != 2) {
        isFiftyFifty = false;
      }
    }

    if (isFiftyFifty) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }

  }
}