import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	}

} Main public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	} main {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] array = scanner.next().toCharArray(); array scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner int count = 0; count 0 for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		} int i = 0; int i = 0; i 0 i < array.length i array.length array array.length i++ i++ i {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		} {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		} for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			} int l = 0; int l = 0; l 0 l < array.length l array.length array array.length l++ l++ l {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			} {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			} if(i == l) {
					continue;
				} i == l i l {
					continue;
				} continue; count += array[i] == array[l] ? 1 : 0 count array[i] == array[l] ? 1 : 0 array[i] == array[l] array[i] array i array[l] array l 1 0 System.out.println(count == 4 ? "Yes" : "No") System.out.println System.out System System.out count == 4 ? "Yes" : "No" count == 4 count 4 "Yes" "No" scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	}

} public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		//入力を配列化
		char[] array = scanner.next().toCharArray();

		//かぶった数
		int count = 0;

		for(int i = 0; i < array.length; i++) {
          
			for(int l = 0; l < array.length; l++) {
              
				//同じ要素を比較しない
				if(i == l) {
					continue;
				}
              
				count += array[i] == array[l] ? 1 : 0;
              
			}
          
		}
		
		System.out.println(count == 4 ? "Yes" : "No");

		scanner.close();
	}

}
