import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan int i; i int length = s.length(); length s.length() s.length s int[] sum = new int[10000]; sum new int[10000] 10000 for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		} i = 0; i = 0 i 0 i < length i length i++ i++ i {
			sum[s.codePointAt(i)]++;
		} {
			sum[s.codePointAt(i)]++;
		} sum[s.codePointAt(i)]++ sum[s.codePointAt(i)] sum s.codePointAt(i) s.codePointAt s i for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		} i = 0; i = 0 i 0 i < length i length i++ i++ i {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		} {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		} if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			} sum[s.codePointAt(i)] != 2 sum[s.codePointAt(i)] sum s.codePointAt(i) s.codePointAt s i 2 {
				System.out.println("No");
				return;
			} System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String s = scan.next();

		int i;
		int length = s.length();
		int[] sum = new int[10000];
		for(i = 0; i < length; i++) {
			sum[s.codePointAt(i)]++;
		}
		for(i = 0; i < length; i++) {
			if(sum[s.codePointAt(i)] != 2) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}