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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        check(line);
    }

    public static void check(String line) {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import java.util.HashMap; HashMap java.util import java.util.Map; Map 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 line = sc.nextLine();
        check(line);
    }

    public static void check(String line) {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        check(line);
    } main {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        check(line);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc check(line) check line String[] args args public static void check(String line) {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } check {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Map<String, String> result = new HashMap<String, String>(); result new HashMap<String, String>() for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        } int i = 0; int i = 0; i 0 i < line.length() i line.length() line.length line i++ i++ i {
            result.put(line.substring(i, i + 1), "");
        } {
            result.put(line.substring(i, i + 1), "");
        } result.put(line.substring(i, i + 1), "") result.put result line.substring(i, i + 1) line.substring line i i + 1 i 1 "" if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } result.size() == 2 result.size() result.size result 2 {
            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 line line public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        check(line);
    }

    public static void check(String line) {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        check(line);
    }

    public static void check(String line) {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        check(line);
    }

    public static void check(String line) {
        Map<String, String> result = new HashMap<String, String>();
        for (int i = 0; i < line.length(); i++) {
            result.put(line.substring(i, i + 1), "");
        }
        if (result.size() == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}