import java.util.Scanner;

public class Main {

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