import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} 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();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char c0 = s.charAt(0); c0 s.charAt(0) s.charAt s 0 char c1 = s.charAt(1); c1 s.charAt(1) s.charAt s 1 char c2 = s.charAt(2); c2 s.charAt(2) s.charAt s 2 char c3 = s.charAt(3); c3 s.charAt(3) s.charAt s 3 if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } c0 == c1 && c2 == c3 && c0 != c2 c0 == c1 && c2 == c3 && c0 != c2 c0 == c1 c0 c1 c2 == c3 c2 c3 c0 != c2 c0 c2 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } c0 == c2 && c1 == c3 && c0 != c1 c0 == c2 && c1 == c3 && c0 != c1 c0 == c2 c0 c2 c1 == c3 c1 c3 c0 != c1 c0 c1 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } c0 == c3 && c1 == c2 && c0 != c1 c0 == c3 && c1 == c2 && c0 != c1 c0 == c3 c0 c3 c1 == c2 c1 c2 c0 != c1 c0 c1 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char c0 = s.charAt(0);
        char c1 = s.charAt(1);
        char c2 = s.charAt(2);
        char c3 = s.charAt(3);

        if (c0 == c1 && c2 == c3 && c0 != c2) {
            System.out.println("Yes");
        } else if (c0 == c2 && c1 == c3 && c0 != c1) {
            System.out.println("Yes");
        } else if (c0 == c3 && c1 == c2 && c0 != c1) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}
