import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	}
	

} import java.util.*; util.* java public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	}
	

} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char[] c = new char[2]; c new char[2] 2 int T = 0; T 0 for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		} int i = 0; int i = 0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		} {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		} char cc = s.charAt(i); cc s.charAt(i) s.charAt s i if(i == 0) {
				c[i] = cc;
				continue;
			} i == 0 i 0 {
				c[i] = cc;
				continue;
			} c[i] = cc c[i] c i cc continue; if(c[0]==cc)continue; c[0]==cc c[0] c 0 cc continue; if(c[1]==cc)continue; c[1]==cc c[1] c 1 cc continue; if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			} c[0]!=cc && T == 0 c[0]!=cc c[0] c 0 cc T == 0 T 0 {
				c[1] =cc;
				T++;
			} c[1] =cc c[1] c 1 cc T++ T {
				T = 2;
				break;
			} T = 2 T 2 break; if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		} T == 2 || T == 0 T == 2 T 2 T == 0 T 0 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" {
			System.out.println("Yes");
		} 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 sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	}
	

} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	}
	

} Main
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = new char[2];
		int T = 0;
		for(int i = 0;i<s.length();i++) {
			char cc = s.charAt(i);
			if(i == 0) {
				c[i] = cc;
				continue;
			}
			if(c[0]==cc)continue;
			if(c[1]==cc)continue;
			if(c[0]!=cc && T == 0) {
				c[1] =cc;
				T++;
			}else {
				T = 2;
				break;
			}
		}
		if(T == 2 || T == 0) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
	}
	

}
