
import java.util.*;


public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    }
} import java.util.*; util.* java public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    }
} Main private static final int INF = Integer.MAX_VALUE; INF Integer.MAX_VALUE Integer Integer.MAX_VALUE public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String[] strArray = str.split(""); strArray str.split("") str.split str "" List<String> list = new ArrayList<>(); list new ArrayList<>() for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        } int tmp = 0; int tmp = 0; tmp 0 tmp < strArray.length tmp strArray.length strArray strArray.length tmp++ tmp++ tmp {
            list.add(strArray[tmp]);

        } {
            list.add(strArray[tmp]);

        } list.add(strArray[tmp]) list.add list strArray[tmp] strArray tmp boolean flagfirst = false; flagfirst false String a = list.get(0); a list.get(0) list.get list 0 for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        } int tmp = 1; int tmp = 1; tmp 1 tmp < list.size() tmp list.size() list.size list tmp++ tmp++ tmp {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        } {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        } if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            } list.get(tmp).equals(list.get(0)) list.get(tmp).equals list.get(tmp) list.get list tmp list.get(0) list.get list 0 {

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            } list.remove(tmp) list.remove list tmp list.remove(0) list.remove list 0 flagfirst=true flagfirst true boolean secondflag = false; secondflag false if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        } list.size() == 2 list.size() list.size list 2 {
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        } if(list.get(0).equals(list.get(1))){
                secondflag = true;
            } list.get(0).equals(list.get(1)) list.get(0).equals list.get(0) list.get list 0 list.get(1) list.get list 1 {
                secondflag = true;
            } secondflag = true secondflag true if(a.equals(list.get(0))) secondflag = false; a.equals(list.get(0)) a.equals a list.get(0) list.get list 0 secondflag = false secondflag false if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } flagfirst && secondflag flagfirst secondflag {
            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 {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    }
} public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    }
} Main

import java.util.*;


public class Main {

    private static final int INF = Integer.MAX_VALUE;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();

        String[] strArray = str.split("");
        List<String> list = new ArrayList<>();

        for (int tmp = 0; tmp < strArray.length ; tmp++) {
            list.add(strArray[tmp]);

        }

        boolean flagfirst = false;
        String a = list.get(0);
        for (int tmp = 1; tmp < list.size() ; tmp++) {
            if(list.get(tmp).equals(list.get(0))){

                list.remove(tmp);
                list.remove(0);
                flagfirst=true;
            }
        }
        boolean secondflag = false;


        if(list.size() == 2){
            if(list.get(0).equals(list.get(1))){
                secondflag = true;
            }

        }
        if(a.equals(list.get(0))) secondflag = false;

        if(flagfirst && secondflag){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }



    }
}
