import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	}
} Main public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	} main {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.nextLine(); a sc.nextLine() sc.nextLine sc String b = "No"; b "No" String[] ar = a.split(""); ar a.split("") a.split a "" if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		} ar[0].equals(ar[1]) ar[0].equals ar[0] ar 0 ar[1] ar 1 {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		} if(ar[2].equals(ar[3])){
				b = "Yes";
			} ar[2].equals(ar[3]) ar[2].equals ar[2] ar 2 ar[3] ar 3 {
				b = "Yes";
			} b = "Yes" b "Yes" if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		} ar[0].equals(ar[2]) ar[0].equals ar[0] ar 0 ar[2] ar 2 {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		} if(ar[1].equals(ar[3])){
				b = "Yes";
			} ar[1].equals(ar[3]) ar[1].equals ar[1] ar 1 ar[3] ar 3 {
				b = "Yes";
			} b = "Yes" b "Yes" if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		} ar[0].equals(ar[3]) ar[0].equals ar[0] ar 0 ar[3] ar 3 {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		} if(ar[1].equals(ar[2])){
				b = "Yes";
			} ar[1].equals(ar[2]) ar[1].equals ar[1] ar 1 ar[2] ar 2 {
				b = "Yes";
			} b = "Yes" b "Yes" if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		} ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3]) ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3]) ar[0].equals(ar[1]) ar[0].equals ar[0] ar 0 ar[1] ar 1 ar[0].equals(ar[2]) ar[0].equals ar[0] ar 0 ar[2] ar 2 ar[0].equals(ar[3]) ar[0].equals ar[0] ar 0 ar[3] ar 3 {
			b = "No";
		} b = "No" b "No" System.out.println(b) System.out.println System.out System System.out b String[] args args public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	}
} public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = "No";
		String[] ar = a.split("");
		if(ar[0].equals(ar[1])) {
			if(ar[2].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[2])) {
			if(ar[1].equals(ar[3])){
				b = "Yes";
			}
		}else if(ar[0].equals(ar[3])) {
			if(ar[1].equals(ar[2])){
				b = "Yes";
			}
		}
		if(ar[0].equals(ar[1]) &&ar[0].equals(ar[2])&&ar[0].equals(ar[3])) {
			b = "No";
		}
			System.out.println(b);

	}
}