import java.io.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    }
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    } main {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    } BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) String[] word = input.readLine().trim().split(""); word input.readLine().trim().split("") input.readLine().trim().split input.readLine().trim() input.readLine().trim input.readLine() input.readLine input "" Arrays.sort(word) Arrays.sort Arrays word System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No") System.out.println System.out System System.out !(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No" !(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) !(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) !(word[1].equals(word[2])) (word[1].equals(word[2])) word[1].equals word[1] word 1 word[2] word 2 word[0].equals(word[1]) word[0].equals word[0] word 0 word[1] word 1 word[2].equals(word[3]) word[2].equals word[2] word 2 word[3] word 3 "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    }
} Main
import java.io.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] word = input.readLine().trim().split("");
        Arrays.sort(word);
        System.out.println(!(word[1].equals(word[2])) && word[0].equals(word[1]) && word[2].equals(word[3]) ? "Yes" : "No");
    }
}
