import java.util.Scanner;

public class Main {

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

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			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 scan = new Scanner(System.in);

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

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

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	} main {
		Scanner scan = new Scanner(System.in);

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int count = 0; count 0 String S = scan.next(); S scan.next() scan.next scan char str [] = new char [S.length()] ; str new char [S.length()] S.length() S.length S for (int i = 0;i < S.length();i++) {
			str[i] = S.charAt(i) ;
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			str[i] = S.charAt(i) ;
		} {
			str[i] = S.charAt(i) ;
		} str[i] = S.charAt(i) str[i] str 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 (str[i] == str[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 (str[i] == str[j]) {
				count++;
				}
			}
		} {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		} for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[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 (str[i] == str[j]) {
				count++;
				}
			} {
				if (str[i] == str[j]) {
				count++;
				}
			} if (str[i] == str[j]) {
				count++;
				} str[i] == str[j] str[i] str i str[j] str j {
				count++;
				} count++ count if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} count == 2 count 2 {
			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 scan = new Scanner(System.in);

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
} public class Main {

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

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
} Main
import java.util.Scanner;

public class Main {

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

		int count = 0;
		String S = scan.next();
		char str [] = new char [S.length()] ;

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

		for (int i = 0; i < S.length() ;i++) {
			for (int j =i+1; j < S.length(); j++) {
				if (str[i] == str[j]) {
				count++;
				}
			}
		}
		if (count == 2) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}
}