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

public class Main {
    //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    }

    static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    }
} import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
    //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    }

    static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    }
} Main //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc if (sln(s)) System.out.println("Yes");
        else System.out.println("No"); sln(s) sln s System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" sc.close() sc.close sc String[] args args static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    } sln {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    } Map<Character, Integer> map = new HashMap<>(); map new HashMap<>() for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1); char c s.toCharArray() s.toCharArray s map.put(c, map.getOrDefault(c, 0) + 1); map.put(c, map.getOrDefault(c, 0) + 1) map.put map c map.getOrDefault(c, 0) + 1 map.getOrDefault(c, 0) map.getOrDefault map c 0 1 if (map.size() != 2) return false; map.size() != 2 map.size() map.size map 2 return false; false for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        } char c map.keySet() map.keySet map {
            if (map.get(c) != 2) return false;
        } {
            if (map.get(c) != 2) return false;
        } if (map.get(c) != 2) return false; map.get(c) != 2 map.get(c) map.get map c 2 return false; false return true; true String s s public class Main {
    //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    }

    static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    }
} public class Main {
    //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    }

    static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    }
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    //Fifty-Fifty
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (sln(s)) System.out.println("Yes");
        else System.out.println("No");
        sc.close();
    }

    static boolean sln(String s) {
        Map<Character, Integer> map = new HashMap<>();
        for (char c : s.toCharArray()) map.put(c, map.getOrDefault(c, 0) + 1);
        if (map.size() != 2) return false;
        for (char c : map.keySet()) {
            if (map.get(c) != 2) return false;
        }
        return true;
    }
}
