import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} import java.io.FileNotFoundException; FileNotFoundException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc sc.close() sc.close sc char[] s = S.toCharArray(); s S.toCharArray() S.toCharArray S int[] count = new int[4]; count new int[4] 4 for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		} {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		} for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			} int j=0; int j=0; j 0 j<S.length() j S.length() S.length S j++ j++ j {
				if(s[i]==s[j]) {
					count[i]++;
				}
			} {
				if(s[i]==s[j]) {
					count[i]++;
				}
			} if(s[i]==s[j]) {
					count[i]++;
				} s[i]==s[j] s[i] s i s[j] s j {
					count[i]++;
				} count[i]++ count[i] count i boolean result = true; result true for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
			if(count[i]!=2) {
				result=false;
			}
		} {
			if(count[i]!=2) {
				result=false;
			}
		} if(count[i]!=2) {
				result=false;
			} count[i]!=2 count[i] count i 2 {
				result=false;
			} result=false result false if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} result {
			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) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		sc.close();

		char[] s = S.toCharArray();

		int[] count = new int[4];

		for(int i=0;i<S.length();i++) {
			for(int j=0;j<S.length();j++) {
				if(s[i]==s[j]) {
					count[i]++;
				}
			}
		}
		boolean result = true;
		for(int i=0;i<S.length();i++) {
			if(count[i]!=2) {
				result=false;
			}
		}
		if(result) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}