import java.util.Scanner;

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

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	}
} 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();

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	} main {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String s1 = s.replaceAll(s.substring(0,1), ""); s1 s.replaceAll(s.substring(0,1), "") s.replaceAll s s.substring(0,1) s.substring s 0 1 "" String s2; s2 if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		} s1.length() != 0 s1.length() s1.length s1 0 {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		} s2 = s1.replaceAll(s1.substring(0, 1), "") s2 s1.replaceAll(s1.substring(0, 1), "") s1.replaceAll s1 s1.substring(0, 1) s1.substring s1 0 1 "" {
			s2 = "AAAAA";
		} s2 = "AAAAA" s2 "AAAAA" if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} s1.length() == 2 && s2.length() ==0 s1.length() == 2 s1.length() s1.length s1 2 s2.length() ==0 s2.length() s2.length s2 0 {
			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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	}
} Main
import java.util.Scanner;

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

		String s1 = s.replaceAll(s.substring(0,1), "");
		String s2;
		if(s1.length() != 0) {
			s2 = s1.replaceAll(s1.substring(0, 1), "");
		}else {
			s2 = "AAAAA";
		}
		
		if(s1.length() == 2 && s2.length() ==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
				
		sc.close();	
	}
}