import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    } main {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int count = 0; count 0 for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        } {
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        } for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            } int j = i + 1; int j = i + 1; j i + 1 i 1 j < 4 j 4 j++ j++ j {
                if( line.charAt(i) == line.charAt(j) ) count++;
            } {
                if( line.charAt(i) == line.charAt(j) ) count++;
            } if( line.charAt(i) == line.charAt(j) ) count++; line.charAt(i) == line.charAt(j) line.charAt(i) line.charAt line i line.charAt(j) line.charAt line j count++ count System.out.println( (count == 2) ? "Yes" : "No" ) System.out.println System.out System System.out (count == 2) ? "Yes" : "No" (count == 2) count 2 "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        int count = 0;
        for(int i = 0; i < 3; i++){
            for(int j = i + 1; j < 4; j++){
                if( line.charAt(i) == line.charAt(j) ) count++;
            }
        }
        
        System.out.println( (count == 2) ? "Yes" : "No" );
    }
}
