import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No");
	}
} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No");
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] input = sc.next().toCharArray(); input sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc Arrays.parallelSort(input) Arrays.parallelSort Arrays input if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No"); input[0]==input[1] && input[2]==input[3] && input[1]!=input[2] input[0]==input[1] && input[2]==input[3] && input[1]!=input[2] input[0]==input[1] input[0] input 0 input[1] input 1 input[2]==input[3] input[2] input 2 input[3] input 3 input[1]!=input[2] input[1] input 1 input[2] input 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);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[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);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No");
	}
} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		char[] input = sc.next().toCharArray();
		Arrays.parallelSort(input);
		if(input[0]==input[1] && input[2]==input[3] && input[1]!=input[2]) System.out.println("Yes");
		else System.out.println("No");
	}
}
