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



public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main static int INFTY=Integer.MAX_VALUE; INFTY Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc char[] arr= new char[4]; arr new char[4] 4 arr[0]=str.charAt(0) arr[0] arr 0 str.charAt(0) str.charAt str 0 arr[1]=str.charAt(1) arr[1] arr 1 str.charAt(1) str.charAt str 1 arr[2]=str.charAt(2) arr[2] arr 2 str.charAt(2) str.charAt str 2 arr[3]=str.charAt(3) arr[3] arr 3 str.charAt(3) str.charAt str 3 boolean bool =false; bool false if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        } arr[0]==arr[1] arr[0] arr 0 arr[1] arr 1 {
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        } if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            } arr[2]==arr[3]&&arr[0]!=arr[2] arr[2]==arr[3] arr[2] arr 2 arr[3] arr 3 arr[0]!=arr[2] arr[0] arr 0 arr[2] arr 2 {
                bool=true;   
            } bool=true bool true if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        } arr[0]==arr[2] arr[0] arr 0 arr[2] arr 2 {
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        } if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            } arr[1]==arr[3]&&arr[0]!=arr[1] arr[1]==arr[3] arr[1] arr 1 arr[3] arr 3 arr[0]!=arr[1] arr[0] arr 0 arr[1] arr 1 {
                bool=true;   
            } bool=true bool true if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        } arr[0]==arr[3] arr[0] arr 0 arr[3] arr 3 {
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        } if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            } arr[1]==arr[2]&&arr[0]!=arr[2] arr[1]==arr[2] arr[1] arr 1 arr[2] arr 2 arr[0]!=arr[2] arr[0] arr 0 arr[2] arr 2 {
                bool=true;   
            } bool=true bool true if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } bool==true bool true {
            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{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;
import java.io.*;



public class Main{
    static int INFTY=Integer.MAX_VALUE;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
            
        String str = sc.nextLine();
        char[] arr= new char[4];
        arr[0]=str.charAt(0);
        arr[1]=str.charAt(1);
        arr[2]=str.charAt(2);
        arr[3]=str.charAt(3);

        boolean bool =false;
        if(arr[0]==arr[1]){
            if(arr[2]==arr[3]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(arr[0]==arr[2]){
            if(arr[1]==arr[3]&&arr[0]!=arr[1]){
                bool=true;   
            }
        }
        if(arr[0]==arr[3]){
            if(arr[1]==arr[2]&&arr[0]!=arr[2]){
                bool=true;   
            }
        }
        if(bool==true){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}