import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    } main {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) char[] chs = in.nextLine().toCharArray(); chs in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in String ans = "No"; ans "No" in.close() in.close in if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        } (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2]) chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2] chs[0] == chs[1] chs[0] chs 0 chs[1] chs 1 chs[2] == chs[3] chs[2] chs 2 chs[3] chs 3 chs[0] != chs[2] chs[0] chs 0 chs[2] chs 2 (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1]) chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1] chs[0] == chs[2] chs[0] chs 0 chs[2] chs 2 chs[1] == chs[3] chs[1] chs 1 chs[3] chs 3 chs[0] != chs[1] chs[0] chs 0 chs[1] chs 1 (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1] chs[0] == chs[3] chs[0] chs 0 chs[3] chs 3 chs[1] == chs[2] chs[1] chs 1 chs[2] chs 2 chs[0] != chs[1] chs[0] chs 0 chs[1] chs 1 {
            ans = "Yes";
        } ans = "Yes" ans "Yes" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] chs = in.nextLine().toCharArray();
        String ans = "No";
        in.close();
        if ( (chs[0] == chs[1] && chs[2] == chs[3] && chs[0] != chs[2])
                || (chs[0] == chs[2] && chs[1] == chs[3] && chs[0] != chs[1])
                || (chs[0] == chs[3] && chs[1] == chs[2] && chs[0] != chs[1]) ) {
            ans = "Yes";
        }
        System.out.println(ans);
    }
}
