import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    }
} import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc HashMap<Character, Integer> cmap = new HashMap<>(); cmap new HashMap<>() for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        } {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        } char c = s.charAt(i); c s.charAt(i) s.charAt s i if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            } cmap.containsKey(c) cmap.containsKey cmap c {
                cmap.replace(c, cmap.get(c) + 1);
            } cmap.replace(c, cmap.get(c) + 1) cmap.replace cmap c cmap.get(c) + 1 cmap.get(c) cmap.get cmap c 1 {
                cmap.put(c, 1);
            } cmap.put(c, 1) cmap.put cmap c 1 String answer = "Yes"; answer "Yes" for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        } Character c cmap.keySet() cmap.keySet cmap {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        } {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        } if (cmap.get(c) != 2) {
                answer = "No";
                break;
            } cmap.get(c) != 2 cmap.get(c) cmap.get cmap c 2 {
                answer = "No";
                break;
            } answer = "No" answer "No" break; System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    }
} Main
import java.util.HashMap;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashMap<Character, Integer> cmap = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (cmap.containsKey(c)) {
                cmap.replace(c, cmap.get(c) + 1);
            } else {
                cmap.put(c, 1);
            }
        }
        String answer = "Yes";
        for (Character c : cmap.keySet()) {
            if (cmap.get(c) != 2) {
                answer = "No";
                break;
            }
        }
        System.out.println(answer);
        sc.close();
    }
}