import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

		if (b) {
			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.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

		if (b) {
			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.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

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

	} main {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

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

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String s0 = S.substring(0, 1); s0 S.substring(0, 1) S.substring S 0 1 String s1 = S.substring(1, 4); s1 S.substring(1, 4) S.substring S 1 4 char[] c = S.toCharArray(); c S.toCharArray() S.toCharArray S boolean b = false; b false int pos = s1.indexOf(s0); pos s1.indexOf(s0) s1.indexOf s1 s0 switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		} pos case 0: 0 case 0: b = (c[2] == c[3]) && (c[0] != c[2]) b (c[2] == c[3]) && (c[0] != c[2]) (c[2] == c[3]) c[2] c 2 c[3] c 3 (c[0] != c[2]) c[0] c 0 c[2] c 2 break; case 1: 1 case 1: b = (c[1] == c[3]) && (c[0] != c[1]) b (c[1] == c[3]) && (c[0] != c[1]) (c[1] == c[3]) c[1] c 1 c[3] c 3 (c[0] != c[1]) c[0] c 0 c[1] c 1 break; case 2: 2 case 2: b = (c[1] == c[2]) && (c[0] != c[1]) b (c[1] == c[2]) && (c[0] != c[1]) (c[1] == c[2]) c[1] c 1 c[2] c 2 (c[0] != c[1]) c[0] c 0 c[1] c 1 break; default: default: break; if (b) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} b {
			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.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

		if (b) {
			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.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

		if (b) {
			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.next();
		String s0 = S.substring(0, 1);
		String s1 = S.substring(1, 4);
		char[] c = S.toCharArray();
		boolean b = false;

		int pos = s1.indexOf(s0);

		switch (pos) {
			case 0:
				b = (c[2] == c[3]) && (c[0] != c[2]);
				break;
			case 1:
				b = (c[1] == c[3]) && (c[0] != c[1]);
				break;
			case 2:
				b = (c[1] == c[2]) && (c[0] != c[1]);
				break;
			default:
				break;
		}

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

	}

}
