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

public class Main {

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

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

        System.out.println(c[0] == c[1] && c[1] != c[2] && c[2] == c[3] ? "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) {
        final Scanner sc = new Scanner(System.in);

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

        System.out.println(c[0] == c[1] && c[1] != c[2] && c[2] == c[3] ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

        System.out.println(c[0] == c[1] && c[1] != c[2] && c[2] == c[3] ? "Yes" : "No");
    } main {
        final Scanner sc = new Scanner(System.in);

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

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

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

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

        System.out.println(c[0] == c[1] && c[1] != c[2] && c[2] == c[3] ? "Yes" : "No");
    }
} public class Main {

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

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

        System.out.println(c[0] == c[1] && c[1] != c[2] && c[2] == c[3] ? "Yes" : "No");
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

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

        final String s = sc.next();
        final char[] c = s.toCharArray();

        Arrays.sort(c);

        System.out.println(c[0] == c[1] && c[1] != c[2] && c[2] == c[3] ? "Yes" : "No");
    }
}
