import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	}
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	} main {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str = scan.nextLine(); str scan.nextLine() scan.nextLine scan char[] ch = str.toCharArray(); ch str.toCharArray() str.toCharArray str if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        } ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3] ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3] ch[0] == ch[1] ch[0] ch 0 ch[1] ch 1 ch[0] == ch[1] ch[0] ch 0 ch[1] ch 1 ch[0] == ch[3] ch[0] ch 0 ch[3] ch 3 {

          System.out.println("No");
          
        } System.out.println("No") System.out.println System.out System System.out "No" if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        } (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) (ch[0] == ch[1] && ch[2] == ch[3]) ch[0] == ch[1] ch[0] ch 0 ch[1] ch 1 ch[2] == ch[3] ch[2] ch 2 ch[3] ch 3 (ch[0] == ch[3] && ch[1] == ch[2]) ch[0] == ch[3] ch[0] ch 0 ch[3] ch 3 ch[1] == ch[2] ch[1] ch 1 ch[2] ch 2 (ch[0] == ch[2] && ch[1] == ch[3]) ch[0] == ch[2] ch[0] ch 0 ch[2] ch 2 ch[1] == ch[3] ch[1] ch 1 ch[3] ch 3 {
          
          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 scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	}
} public class Main {
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] ch = str.toCharArray();
 
        if (ch[0] == ch[1] && ch[0] == ch[1] && ch[0] == ch[3]) {

          System.out.println("No");
          
        } else if ( (ch[0] == ch[1] && ch[2] == ch[3]) ||
                    (ch[0] == ch[3] && ch[1] == ch[2]) ||
                    (ch[0] == ch[2] && ch[1] == ch[3]) ) {
          
          System.out.println("Yes");
            
        } else {
          System.out.println("No");
        }
	}
}