import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        }
        
    }


} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        }
        
    }


} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String[] split = S.split(""); split S.split("") S.split S "" int count = 0; count 0 String moji = ""; moji "" for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        } int i = 0; int i = 0; i 0 i < 4 i 4 i++ i++ i {
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        } {
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        } for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            } int j = 0; int j = 0; j 0 j < 4 j 4 j++ j++ j {

                if(split[i].equals(split[j])){
                    count++;
                }
            
            } {

                if(split[i].equals(split[j])){
                    count++;
                }
            
            } if(split[i].equals(split[j])){
                    count++;
                } split[i].equals(split[j]) split[i].equals split[i] split i split[j] split j {
                    count++;
                } count++ count if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        } count == 8 count 8 {
            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 S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            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 S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        }
        
    }


} Main
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String[] split = S.split("");

        int count = 0;
        String moji = "";

        for (int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){

                if(split[i].equals(split[j])){
                    count++;
                }
            
            }
        }

        if(count == 8){
            System.out.println("Yes");    
        }
        else{
            System.out.println("No");
        }
        
    }


}