import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char[] sArray = S.toCharArray(); sArray S.toCharArray() S.toCharArray S Arrays.sort(sArray) Arrays.sort Arrays sArray String result = "No"; result "No" if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		} sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3] sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3] sArray[0] == sArray[1] sArray[0] sArray 0 sArray[1] sArray 1 sArray[0] != sArray[2] sArray[0] sArray 0 sArray[2] sArray 2 sArray[2] == sArray[3] sArray[2] sArray 2 sArray[3] sArray 3 {
			result = "Yes";
		} result = "Yes" result "Yes" System.out.println(result) System.out.println System.out System System.out result sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		char[] sArray = S.toCharArray();
		Arrays.sort(sArray);
		String result = "No";
		if (sArray[0] == sArray[1] && sArray[0] != sArray[2] && sArray[2] == sArray[3]) {
			result = "Yes";
		}
		System.out.println(result);
		sc.close();
	}
}