import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            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) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } int count = 0; count 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.nextLine(); a sc.nextLine() sc.nextLine sc String[] b = a.split(""); b a.split("") a.split a "" for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        } int i = 0; int i = 0; i 0 i <= 2 i 2 i++ i++ i {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        } {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        } for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            } int j =i+1; int j =i+1; j i+1 i 1 j <= 4 j 4 j++ j++ j {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            } {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            } if(j==4){
                    continue;
                } j==4 j 4 {
                    continue;
                } continue; if (b[i].equals(b[j])) {
                    count++;
                } b[i].equals(b[j]) b[i].equals b[i] b i b[j] b j {
                    count++;
                } count++ count if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } count == 2 count 2 {
            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) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int count = 0;
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split("");
        for (int i = 0; i <= 2; i++) {
            for (int j =i+1; j <= 4; j++) {
                if(j==4){
                    continue;
                }
                if (b[i].equals(b[j])) {
                    count++;
                }
            }
        }
        if (count == 2) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
