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();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    }
} 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();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    }
} Main public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    } main {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String[] arrS = s.split(""); arrS s.split("") s.split s "" Arrays.sort(arrS) Arrays.sort Arrays arrS boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]); result arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]) arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]) arrS[0].equals(arrS[1]) arrS[0].equals arrS[0] arrS 0 arrS[1] arrS 1 arrS[2].equals(arrS[3]) arrS[2].equals arrS[2] arrS 2 arrS[3] arrS 3 !arrS[0].equals(arrS[2]) arrS[0].equals(arrS[2]) arrS[0].equals arrS[0] arrS 0 arrS[2] arrS 2 System.out.println(result ? "Yes" : "No") System.out.println System.out System System.out result ? "Yes" : "No" result "Yes" "No" String args[] args public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

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

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    }
} 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();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    }
}
