import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("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();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc char[] line1 = line.toCharArray(); line1 line.toCharArray() line.toCharArray line if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No"); line1[0] == line1[1] line1[0] line1 0 line1[1] line1 1 {
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        } if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No"); line1[2] != line1[1] line1[2] line1 2 line1[1] line1 1 {
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            } if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No"); line1[2] == line1[3] line1[2] line1 2 line1[3] line1 3 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.out.println("No") System.out.println System.out System System.out "No" if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No"); line1[0] == line1[2] line1[0] line1 0 line1[2] line1 2 {
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        } if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No"); line1[0] != line1[1] line1[0] line1 0 line1[1] line1 1 {
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            } if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No"); line1[1] == line1[3] line1[1] line1 1 line1[3] line1 3 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.out.println("No") System.out.println System.out System System.out "No" if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No"); line1[0] == line1[3] line1[0] line1 0 line1[3] line1 3 {
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        } if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No"); line1[0] != line1[1] line1[0] line1 0 line1[1] line1 1 {
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            } if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No"); line1[1] == line1[2] line1[1] line1 1 line1[2] line1 2 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.out.println("No") System.out.println System.out System System.out "No" if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No"); line1[1] == line1[2] line1[1] line1 1 line1[2] line1 2 {
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        } if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No"); line1[0] != line1[1] line1[0] line1 0 line1[1] line1 1 {
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            } if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No"); line1[0] == line1[3] line1[0] line1 0 line1[3] line1 3 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.out.println("No") System.out.println System.out System System.out "No" if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No"); line1[1] == line1[3] line1[1] line1 1 line1[3] line1 3 {
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        } if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No"); line1[0] != line1[1] line1[0] line1 0 line1[1] line1 1 {
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            } if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No"); line1[0] == line1[2] line1[0] line1 0 line1[2] line1 2 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.out.println("No") System.out.println System.out System System.out "No" if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No"); line1[2] == line1[3] line1[2] line1 2 line1[3] line1 3 {
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        } if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No"); line1[1] != line1[2] line1[1] line1 1 line1[2] line1 2 {
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            } if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No"); line1[0] == line1[1] line1[0] line1 0 line1[1] line1 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.out.println("No") System.out.println System.out System System.out "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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("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();
        char[] line1 = line.toCharArray();
        if(line1[0] == line1[1]){
            if(line1[2] != line1[1]){
                if(line1[2] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[0] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[1] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[2]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[3])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[1] == line1[3]){
            if(line1[0] != line1[1]){
                if(line1[0] == line1[2])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else if(line1[2] == line1[3]){
            if(line1[1] != line1[2]){
                if(line1[0] == line1[1])
                System.out.println("Yes");
                else
                System.out.println("No");
            }
            else
            System.out.println("No");
        }
        else
        System.out.println("No");
    }
}