import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String[] Sarray = new String[S.length()]; Sarray new String[S.length()] S.length() S.length S for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        } {
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        } String tmps = String.valueOf(S.charAt(i)); tmps String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i Sarray[i] = tmps Sarray[i] Sarray i tmps String tmps = Sarray[0]; tmps Sarray[0] Sarray 0 boolean f = false; f false int count = 0; count 0 for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        } int i=1; int i=1; i 1 i<4 i 4 i++ i++ i {
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        } {
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        } if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            } String.valueOf(Sarray[i]).equals(tmps) String.valueOf(Sarray[i]).equals String.valueOf(Sarray[i]) String.valueOf String Sarray[i] Sarray i tmps {
                count++;
            } count++ count if(count==3){
            f = true;
        } count==3 count 3 {
            f = true;
        } f = true f true List<String> list = new ArrayList<String>(); list new ArrayList<String>() for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        } int i=0; int i=0; i 0 i<4 i 4 i++ i++ i {
            list.add(Sarray[i]);
        } {
            list.add(Sarray[i]);
        } list.add(Sarray[i]) list.add list Sarray[i] Sarray i Collections.sort(list) Collections.sort Collections list String[] array = list.toArray(new String[list.size()]); array list.toArray(new String[list.size()]) list.toArray list new String[list.size()] list.size() list.size list if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } (f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3])) (f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3])) (f==false) f false String.valueOf(array[0]).equals(String.valueOf(array[1])) String.valueOf(array[0]).equals String.valueOf(array[0]) String.valueOf String array[0] array 0 String.valueOf(array[1]) String.valueOf String array[1] array 1 String.valueOf(array[2]).equals(String.valueOf(array[3])) String.valueOf(array[2]).equals String.valueOf(array[2]) String.valueOf String array[2] array 2 String.valueOf(array[3]) String.valueOf String array[3] array 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 S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[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 S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String[] Sarray = new String[S.length()];
        for(int i=0;i<S.length();i++){
            String tmps = String.valueOf(S.charAt(i));
            Sarray[i] = tmps;
        }
        String tmps = Sarray[0];
        boolean f = false;
        int count = 0;
        for(int i=1;i<4;i++){
            if(String.valueOf(Sarray[i]).equals(tmps)){
                count++;
            }
        }
        if(count==3){
            f = true;
        }
        List<String> list = new ArrayList<String>();        
        for(int i=0;i<4;i++){
            list.add(Sarray[i]);
        }
        Collections.sort(list);
        String[] array = list.toArray(new String[list.size()]);
        if((f==false)&&String.valueOf(array[0]).equals(String.valueOf(array[1]))&&String.valueOf(array[2]).equals(String.valueOf(array[3]))){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}