
import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	}
} Main public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	} main {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc char ch[] = new char[S.length()]; ch new char[S.length()] S.length() S.length S int count = 0; count 0 for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			ch[i] = S.charAt(i);
		} {
			ch[i] = S.charAt(i);
		} ch[i] = S.charAt(i) ch[i] ch i S.charAt(i) S.charAt S i for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		} {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		} for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			} int j = i + 1; int j = i + 1; j i + 1 i 1 j < S.length() j S.length() S.length S j++ j++ j {
				if (ch[i] == ch[j]) {
					count++;
				}
			} {
				if (ch[i] == ch[j]) {
					count++;
				}
			} if (ch[i] == ch[j]) {
					count++;
				} ch[i] == ch[j] ch[i] ch i ch[j] ch j {
					count++;
				} count++ count System.out.print(count == 2 ? "Yes" : "No") System.out.print System.out System System.out count == 2 ? "Yes" : "No" count == 2 count 2 "Yes" "No" String arg[] arg public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	}
} public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		char ch[] = new char[S.length()];

		int count = 0;

		for (int i = 0; i < S.length(); i++) {
			ch[i] = S.charAt(i);
		}

		for (int i = 0; i < S.length(); i++) {
			for (int j = i + 1; j < S.length(); j++) {
				if (ch[i] == ch[j]) {
					count++;
				}
			}
		}
		System.out.print(count == 2 ? "Yes" : "No");
	}
}
