
import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        try  (Scanner scanner = new Scanner(System.in);) {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        }
    }

} import java.util.Scanner; Scanner java.util class Main {
    public static void main(final String[] args) {
        try  (Scanner scanner = new Scanner(System.in);) {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        }
    }

} Main public static void main(final String[] args) {
        try  (Scanner scanner = new Scanner(System.in);) {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        }
    } main {
        try  (Scanner scanner = new Scanner(System.in);) {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        }
    } try  (Scanner scanner = new Scanner(System.in);) {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        } {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        } Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner int count = 0; count 0 boolean flag = true; flag true for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            } int i=0; int i=0; i 0 i < 4 i 4 i++ i++ i {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            } {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            } String s1 = s.substring(i,i+1); s1 s.substring(i,i+1) s.substring s i i+1 i 1 for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                } int k=0; int k=0; k 0 k < 4 k 4 k++ k++ k {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                } {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                } String s2 = s.substring(k,k+1); s2 s.substring(k,k+1) s.substring s k k+1 k 1 if (s1.equals(s2)) {
                        count++;
                    } s1.equals(s2) s1.equals s1 s2 {
                        count++;
                    } count++ count if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                } count == 2 count 2 {
                    count = 0;
                } count = 0 count 0 {
                    System.out.println("No");
                    flag = false;
                    break;
                } System.out.println("No") System.out.println System.out System System.out "No" flag = false flag false break; if (flag) {
                System.out.println("Yes");
            } flag {
                System.out.println("Yes");
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" final String[] args args

import java.util.Scanner;

class Main {
    public static void main(final String[] args) {
        try  (Scanner scanner = new Scanner(System.in);) {
            String s = scanner.nextLine();
            int count = 0;
            boolean flag = true;
            for (int i=0; i < 4; i++) {
                String s1 = s.substring(i,i+1);
                for (int k=0; k < 4; k++) {
                    String s2 = s.substring(k,k+1);
                    if (s1.equals(s2)) {
                        count++;
                    }
                }
                if (count == 2) {
                    count = 0;
                } else {
                    System.out.println("No");
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.println("Yes");
            }
        }
    }

}
