import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.size() == 2){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	}
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.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  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.size() == 2){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	} main {
    
    Scanner sc = new Scanner(System.in);
    String  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.size() == 2){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String  A = sc.next(); A sc.next() sc.next sc char[] a = A.toCharArray(); a A.toCharArray() A.toCharArray A ArrayList<Character> aa = new ArrayList<>(); aa new ArrayList<>() for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
} int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
} {
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
} if(!aa.contains(a[i])){
		aa.add(a[i]);
	} !aa.contains(a[i]) aa.contains(a[i]) aa.contains aa a[i] a i {
		aa.add(a[i]);
	} aa.add(a[i]) aa.add aa a[i] a i if(aa.size() == 2){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	} aa.size() == 2 aa.size() aa.size aa 2 {
		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){
    
    Scanner sc = new Scanner(System.in);
    String  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.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  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.size() == 2){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	}
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    String  A = sc.next();
    char[] a = A.toCharArray();
    ArrayList<Character> aa = new ArrayList<>();

	for(int i=0; i<4; i++){
	if(!aa.contains(a[i])){
		aa.add(a[i]);
	}
}
	if(aa.size() == 2){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	}
}
