import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static void sortNatualOrder(List<Integer> intList) {
        for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static void sortNatualOrder(List<Integer> intList) {
        for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        }
    }
} Main public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    } main {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    } try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } IOException | NumberFormatException e {
            e.printStackTrace();
            System.exit(0);
        } e.printStackTrace() e.printStackTrace e System.exit(0) System.exit System 0 catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        } final Exception e {
            e.printStackTrace();
            System.exit(0);
        } e.printStackTrace() e.printStackTrace e System.exit(0) System.exit System 0 {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char[] input = br.readLine().toCharArray(); input br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br List<Integer> charToIntList = new ArrayList<>(); charToIntList new ArrayList<>() for (char c : input) {
                charToIntList.add((int) c);
            } char c input {
                charToIntList.add((int) c);
            } {
                charToIntList.add((int) c);
            } charToIntList.add((int) c) charToIntList.add charToIntList (int) c sortNatualOrder(charToIntList) sortNatualOrder charToIntList String result = "No"; result "No" if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            } charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2) charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2) charToIntList.get(0) == charToIntList.get(1) charToIntList.get(0) charToIntList.get charToIntList 0 charToIntList.get(1) charToIntList.get charToIntList 1 charToIntList.get(2) == charToIntList.get(3) charToIntList.get(2) charToIntList.get charToIntList 2 charToIntList.get(3) charToIntList.get charToIntList 3 charToIntList.get(1) != charToIntList.get(2) charToIntList.get(1) charToIntList.get charToIntList 1 charToIntList.get(2) charToIntList.get charToIntList 2 {
                result = "Yes";
            } result = "Yes" result "Yes" System.out.println(result) System.out.println System.out System System.out result String[] args args private static void sortNatualOrder(List<Integer> intList) {
        for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        }
    } sortNatualOrder {
        for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        }
    } for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        } int i = 0; int i = 0; i 0 i < intList.size() - 1 i intList.size() - 1 intList.size() intList.size intList 1 i++ i++ i {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        } {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        } for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            } int j = intList.size() - 1; int j = intList.size() - 1; j intList.size() - 1 intList.size() intList.size intList 1 j > i j i j-- j-- j {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            } {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            } if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                } intList.get(j - 1) > intList.get(j) intList.get(j - 1) intList.get intList j - 1 j 1 intList.get(j) intList.get intList j {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                } int tmp = intList.get(j - 1); tmp intList.get(j - 1) intList.get intList j - 1 j 1 intList.set(j - 1, intList.get(j)) intList.set intList j - 1 j 1 intList.get(j) intList.get intList j intList.set(j, tmp) intList.set intList j tmp List<Integer> intList intList
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            char[] input = br.readLine().toCharArray();
            List<Integer> charToIntList = new ArrayList<>();

            for (char c : input) {
                charToIntList.add((int) c);
            }

            sortNatualOrder(charToIntList);

            String result = "No";
            if (charToIntList.get(0) == charToIntList.get(1)
                && charToIntList.get(2) == charToIntList.get(3) 
                && charToIntList.get(1) != charToIntList.get(2)) {
                result = "Yes";
            }

            System.out.println(result);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }

    private static void sortNatualOrder(List<Integer> intList) {
        for (int i = 0; i < intList.size() - 1; i++) {
            for (int j = intList.size() - 1; j > i; j--) {
                if (intList.get(j - 1) > intList.get(j)) {
                    int tmp = intList.get(j - 1);
                    intList.set(j - 1, intList.get(j));
                    intList.set(j, tmp);
                }
            }
        }
    }
}