import java.util.*;

class Main{
    public static void main(String args[]){
        int count = 0;
        String ans[] = {"No","Yes"};
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char a[] = new char[str.length()];
        for(int i = 0;i < str.length();i++){
            a[i] = str.charAt(i);
        }
        if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
            
        }else if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        }
        System.out.print(ans[count]);
    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]){
        int count = 0;
        String ans[] = {"No","Yes"};
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char a[] = new char[str.length()];
        for(int i = 0;i < str.length();i++){
            a[i] = str.charAt(i);
        }
        if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
            
        }else if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        }
        System.out.print(ans[count]);
    }
} Main public static void main(String args[]){
        int count = 0;
        String ans[] = {"No","Yes"};
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char a[] = new char[str.length()];
        for(int i = 0;i < str.length();i++){
            a[i] = str.charAt(i);
        }
        if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
            
        }else if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        }
        System.out.print(ans[count]);
    } main {
        int count = 0;
        String ans[] = {"No","Yes"};
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char a[] = new char[str.length()];
        for(int i = 0;i < str.length();i++){
            a[i] = str.charAt(i);
        }
        if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
            
        }else if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        }
        System.out.print(ans[count]);
    } int count = 0; count 0 String ans[] = {"No","Yes"}; ans {"No","Yes"} "No" "Yes" Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc char a[] = new char[str.length()]; a new char[str.length()] str.length() str.length str for(int i = 0;i < str.length();i++){
            a[i] = str.charAt(i);
        } int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
            a[i] = str.charAt(i);
        } {
            a[i] = str.charAt(i);
        } a[i] = str.charAt(i) a[i] a i str.charAt(i) str.charAt str i if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
            
        }else if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        } a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3] a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3] a[0]==a[1] a[0] a 0 a[1] a 1 a[1]==a[2] a[1] a 1 a[2] a 2 a[2]==a[3] a[2] a 2 a[3] a 3 {
            
        } if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        } a[0]==a[1]&&a[2]==a[3] a[0]==a[1] a[0] a 0 a[1] a 1 a[2]==a[3] a[2] a 2 a[3] a 3 {
            count++;
        } count++ count if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        } a[0]==a[2]&&a[1]==a[3] a[0]==a[2] a[0] a 0 a[2] a 2 a[1]==a[3] a[1] a 1 a[3] a 3 {
            count++;
        } count++ count if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        } a[0]==a[3]&&a[1]==a[2] a[0]==a[3] a[0] a 0 a[3] a 3 a[1]==a[2] a[1] a 1 a[2] a 2 {
            count++;
        } count++ count System.out.print(ans[count]) System.out.print System.out System System.out ans[count] ans count String args[] args
import java.util.*;

class Main{
    public static void main(String args[]){
        int count = 0;
        String ans[] = {"No","Yes"};
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char a[] = new char[str.length()];
        for(int i = 0;i < str.length();i++){
            a[i] = str.charAt(i);
        }
        if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]){
            
        }else if(a[0]==a[1]&&a[2]==a[3]){
            count++;
        }else if(a[0]==a[2]&&a[1]==a[3]){
            count++;
        }else if(a[0]==a[3]&&a[1]==a[2]){
            count++;
        }
        System.out.print(ans[count]);
    }
}