import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

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

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (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 str = sc.next();

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (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 str = sc.next();

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (c0 == c3 && c1 == c2 & c0 != c1)) {

            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {

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

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (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 str = sc.next(); str sc.next() sc.next sc char c0 = str.charAt(0); c0 str.charAt(0) str.charAt str 0 char c1 = str.charAt(1); c1 str.charAt(1) str.charAt str 1 char c2 = str.charAt(2); c2 str.charAt(2) str.charAt str 2 char c3 = str.charAt(3); c3 str.charAt(3) str.charAt str 3 if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (c0 == c3 && c1 == c2 & c0 != c1)) {

            System.out.println("Yes");
        } else {
            System.out.println("No");
        } (c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (c0 == c3 && c1 == c2 & c0 != c1) (c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (c0 == c3 && c1 == c2 & c0 != c1) (c0 == c1 && c2 == c3 & c0 != c2) c0 == c1 c0 c1 c2 == c3 & c0 != c2 c2 == c3 c2 c3 c0 != c2 c0 c2 (c0 == c2 && c1 == c3 & c0 != c1) c0 == c2 c0 c2 c1 == c3 & c0 != c1 c1 == c3 c1 c3 c0 != c1 c0 c1 (c0 == c3 && c1 == c2 & c0 != c1) c0 == c3 c0 c3 c1 == c2 & c0 != c1 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 str = sc.next();

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (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 str = sc.next();

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (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 str = sc.next();

        char c0 = str.charAt(0);
        char c1 = str.charAt(1);
        char c2 = str.charAt(2);
        char c3 = str.charAt(3);

        if ((c0 == c1 && c2 == c3 & c0 != c2)
            || (c0 == c2 && c1 == c3 & c0 != c1)
                || (c0 == c3 && c1 == c2 & c0 != c1)) {

            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}