import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    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.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    System.out.println("Yes");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    System.out.println("Yes");
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    System.out.println("Yes");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc Map<Character, Integer> map = new HashMap<>(); map new HashMap<>() for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    } char c s.toCharArray() s.toCharArray s {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    } {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    } if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        } map.containsKey(c) map.containsKey map c {
        	map.put(c, map.get(c) + 1);
        } map.put(c, map.get(c) + 1) map.put map c map.get(c) + 1 map.get(c) map.get map c 1 {
          map.put(c, 1);
        } map.put(c, 1) map.put map c 1 for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    } char i map.keySet() map.keySet map {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    } {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    } if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        } map.get(i) != 2 map.get(i) map.get map i 2 {
        	System.out.println("No");
          	return;
        } System.out.println("No") System.out.println System.out System System.out "No" return; 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.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    System.out.println("Yes");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    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.nextLine();
    Map<Character, Integer> map = new HashMap<>();
    for (char c : s.toCharArray()) {
    	if (map.containsKey(c)) {
        	map.put(c, map.get(c) + 1);
        } else {
          map.put(c, 1);
        }
    }
    
    for (char i : map.keySet()) {
    	if (map.get(i) != 2) {
        	System.out.println("No");
          	return;
        }
    }
    System.out.println("Yes");
  }
}