import java.util.Arrays;
import java.util.Scanner;

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

        String S = sc.next();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(String S) {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    }
} import java.util.Arrays; Arrays 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();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(String S) {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc System.out.println(solve(S) ? "Yes" : "No") System.out.println System.out System System.out solve(S) ? "Yes" : "No" solve(S) solve S "Yes" "No" sc.close() sc.close sc String[] args args static boolean solve(String S) {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    } solve {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    } char[] letters = S.toCharArray(); letters S.toCharArray() S.toCharArray S Arrays.sort(letters) Arrays.sort Arrays letters return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3]; letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3] letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3] letters[0] == letters[1] letters[0] letters 0 letters[1] letters 1 letters[1] != letters[2] letters[1] letters 1 letters[2] letters 2 letters[2] == letters[3] letters[2] letters 2 letters[3] letters 3 String S S public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(String S) {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String S = sc.next();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(String S) {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

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

        String S = sc.next();

        System.out.println(solve(S) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(String S) {
        char[] letters = S.toCharArray();
        Arrays.sort(letters);

        return letters[0] == letters[1] && letters[1] != letters[2] && letters[2] == letters[3];
    }
}