import java.util.Scanner;

public class Main {

    //https://atcoder.jp/contests/abc132/tasks/abc132_a
    public static void main( String[] args ) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    }
} import java.util.Scanner; Scanner java.util public class Main {

    //https://atcoder.jp/contests/abc132/tasks/abc132_a
    public static void main( String[] args ) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    }
} Main //https://atcoder.jp/contests/abc132/tasks/abc132_a
    public static void main( String[] args ) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    } main {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String str = scanner.next(); str scanner.next() scanner.next scanner int[] arr = new int[26]; arr new int[26] 26 for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            arr[str.charAt(i) - 'A']++;
        } {
            arr[str.charAt(i) - 'A']++;
        } arr[str.charAt(i) - 'A']++ arr[str.charAt(i) - 'A'] arr str.charAt(i) - 'A' str.charAt(i) str.charAt str i 'A' int type = 0; type 0 for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        } int i = 0; int i = 0; i 0 i < 26 i 26 i++ i++ i {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        } {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        } if (arr[i] > 0 && arr[i] == 2) {
                type++;
            } arr[i] > 0 && arr[i] == 2 arr[i] > 0 arr[i] arr i 0 arr[i] == 2 arr[i] arr i 2 {
                type++;
            } type++ type System.out.println(type == 2 ? "Yes" : "No") System.out.println System.out System System.out type == 2 ? "Yes" : "No" type == 2 type 2 "Yes" "No" String[] args args public class Main {

    //https://atcoder.jp/contests/abc132/tasks/abc132_a
    public static void main( String[] args ) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    }
} public class Main {

    //https://atcoder.jp/contests/abc132/tasks/abc132_a
    public static void main( String[] args ) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    }
} Main
import java.util.Scanner;

public class Main {

    //https://atcoder.jp/contests/abc132/tasks/abc132_a
    public static void main( String[] args ) {

        Scanner scanner = new Scanner(System.in);

        String str = scanner.next();

        int[] arr = new int[26];
        for (int i = 0; i < 4; i++) {
            arr[str.charAt(i) - 'A']++;
        }

        int type = 0;
        for (int i = 0; i < 26; i++) {

            if (arr[i] > 0 && arr[i] == 2) {
                type++;
            }
        }

        System.out.println(type == 2 ? "Yes" : "No");
    }
}
