import java.util.*;

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

    Scanner sc=new Scanner(System.in);
    
    String s=sc.next();
    
    char[]sArray=s.toCharArray();
    
    String result = "No";
		if ((sArray[0] == sArray[1] && sArray[2] == sArray[3] && sArray[0] != sArray[2])
				|| (sArray[0] == sArray[2] && sArray[1] == sArray[3] && sArray[0] != sArray[1])
				|| (sArray[0] == sArray[3] && sArray[1] == sArray[2] && sArray[0] != sArray[1])) {
			result = "Yes";
		}
 
		System.out.println(result);
		sc.close();
	}
}
     import java.util.*; util.* java public class Main{
  public static void main(String[]args){

    Scanner sc=new Scanner(System.in);
    
    String s=sc.next();
    
    char[]sArray=s.toCharArray();
    
    String result = "No";
		if ((sArray[0] == sArray[1] && sArray[2] == sArray[3] && sArray[0] != sArray[2])
				|| (sArray[0] == sArray[2] && sArray[1] == sArray[3] && sArray[0] != sArray[1])
				|| (sArray[0] == sArray[3] && sArray[1] == sArray[2] && sArray[0] != sArray[1])) {
			result = "Yes";
		}
 
		System.out.println(result);
		sc.close();
	}
} Main public static void main(String[]args){

    Scanner sc=new Scanner(System.in);
    
    String s=sc.next();
    
    char[]sArray=s.toCharArray();
    
    String result = "No";
		if ((sArray[0] == sArray[1] && sArray[2] == sArray[3] && sArray[0] != sArray[2])
				|| (sArray[0] == sArray[2] && sArray[1] == sArray[3] && sArray[0] != sArray[1])
				|| (sArray[0] == sArray[3] && sArray[1] == sArray[2] && sArray[0] != sArray[1])) {
			result = "Yes";
		}
 
		System.out.println(result);
		sc.close();
	} main {

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

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

    Scanner sc=new Scanner(System.in);
    
    String s=sc.next();
    
    char[]sArray=s.toCharArray();
    
    String result = "No";
		if ((sArray[0] == sArray[1] && sArray[2] == sArray[3] && sArray[0] != sArray[2])
				|| (sArray[0] == sArray[2] && sArray[1] == sArray[3] && sArray[0] != sArray[1])
				|| (sArray[0] == sArray[3] && sArray[1] == sArray[2] && sArray[0] != sArray[1])) {
			result = "Yes";
		}
 
		System.out.println(result);
		sc.close();
	}
} Main
import java.util.*;

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

    Scanner sc=new Scanner(System.in);
    
    String s=sc.next();
    
    char[]sArray=s.toCharArray();
    
    String result = "No";
		if ((sArray[0] == sArray[1] && sArray[2] == sArray[3] && sArray[0] != sArray[2])
				|| (sArray[0] == sArray[2] && sArray[1] == sArray[3] && sArray[0] != sArray[1])
				|| (sArray[0] == sArray[3] && sArray[1] == sArray[2] && sArray[0] != sArray[1])) {
			result = "Yes";
		}
 
		System.out.println(result);
		sc.close();
	}
}
    
