import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int total = 0;
        
		for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		}
		
		System.out.println(total == 2 ? "Yes" : "No");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int total = 0;
        
		for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		}
		
		System.out.println(total == 2 ? "Yes" : "No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int total = 0;
        
		for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		}
		
		System.out.println(total == 2 ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int total = 0;
        
		for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		}
		
		System.out.println(total == 2 ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc int total = 0; total 0 for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		} 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 (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		} {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		} for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			} 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 (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			} {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			} if (s.charAt(i) == s.charAt(j)) {
					total++;
				} s.charAt(i) == s.charAt(j) s.charAt(i) s.charAt s i s.charAt(j) s.charAt s j {
					total++;
				} total++ total System.out.println(total == 2 ? "Yes" : "No") System.out.println System.out System System.out total == 2 ? "Yes" : "No" total == 2 total 2 "Yes" "No" String[] args args public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int total = 0;
        
		for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		}
		
		System.out.println(total == 2 ? "Yes" : "No");
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
        int total = 0;
        
		for (int i = 0; i < s.length(); i++) {
			for ( int j = i + 1; j < s.length(); j++) {
				if (s.charAt(i) == s.charAt(j)) {
					total++;
				}
			}
		}
		
		System.out.println(total == 2 ? "Yes" : "No");
	}
} Main
import java.util.Scanner;

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