import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 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) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 2) {
			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.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc int countA = 1; countA 1 int countB = 1; countB 1 char a; a char b; b a = s.charAt(0) a s.charAt(0) s.charAt s 0 for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		} int j = 1; int j = 1; j 1 j < s.length() j s.length() s.length s j++ j++ j {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		} {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		} b = s.charAt(j) b s.charAt(j) s.charAt s j if (a == b ) {
				countA++;
			} a == b a b {
				countA++;
			} countA++ countA if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		} countA == 2 countA 2 {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		} if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			} s.charAt(0) != (s.charAt(1)) s.charAt(0) s.charAt s 0 (s.charAt(1)) s.charAt s 1 {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} a = s.charAt(1) a s.charAt(1) s.charAt s 1 for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				} int j = 2; int j = 2; j 2 j < s.length() j s.length() s.length s j++ j++ j {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				} {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				} b = s.charAt(j) b s.charAt(j) s.charAt s j if (a ==  b) {
						countB++;
					} a ==  b a b {
						countB++;
					} countB++ countB {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			} a = s.charAt(2) a s.charAt(2) s.charAt s 2 b = s.charAt(3) b s.charAt(3) s.charAt s 3 if (a == b) {
					countB++;
				} a == b a b {
					countB++;
				} countB++ countB if (countA == 2 & countB == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} countA == 2 & countB == 2 countA == 2 countA 2 countB == 2 countB 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) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 2) {
			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.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 2) {
			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.nextLine();
		int countA = 1;
		int countB = 1;

		char a;
		char b;

		a = s.charAt(0);
		for (int j = 1; j < s.length(); j++) {
			b = s.charAt(j);
			if (a == b ) {
				countA++;
			}
		}
//		System.out.println(countA);

		if (countA == 2) {
			if (s.charAt(0) != (s.charAt(1))) {
				a = s.charAt(1);
				for (int j = 2; j < s.length(); j++) {
					b = s.charAt(j);
					if (a ==  b) {
						countB++;
					}
				}
			} else {
				a = s.charAt(2);
				b = s.charAt(3);
				if (a == b) {
					countB++;
				}
			}
		}
//		System.out.println(countB);

		if (countA == 2 & countB == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}
