import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc char[] ch = str.toCharArray(); ch str.toCharArray() str.toCharArray str ArrayList<Character> check = new ArrayList<>(); check new ArrayList<>() for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		} int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		} {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		} if(!check.contains(ch[i])) {
				check.add(ch[i]);
			} !check.contains(ch[i]) check.contains(ch[i]) check.contains check ch[i] ch i {
				check.add(ch[i]);
			} check.add(ch[i]) check.add check ch[i] ch i if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No"); check.size() == 2 check.size() check.size check 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 sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	}
} Main
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		char[] ch = str.toCharArray();
		ArrayList<Character> check = new ArrayList<>();
		
		for(int i = 0; i < 4; i++) {
			if(!check.contains(ch[i])) {
				check.add(ch[i]);
			}
		}
		if(check.size() == 2) System.out.println("Yes");
		else System.out.println("No");
	}
}