import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        char s[] = inp.next().toCharArray();
        Arrays.sort(s);
        if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} import java.util.*; util.* java class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        char s[] = inp.next().toCharArray();
        Arrays.sort(s);
        if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
} Main public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    } main {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    } Scanner inp = new Scanner(System.in); inp new Scanner(System.in) do_(inp) do_ inp inp.close() inp.close inp String args[] args public static void do_(Scanner inp) {
        char s[] = inp.next().toCharArray();
        Arrays.sort(s);
        if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } do_ {
        char s[] = inp.next().toCharArray();
        Arrays.sort(s);
        if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    } char s[] = inp.next().toCharArray(); s inp.next().toCharArray() inp.next().toCharArray inp.next() inp.next inp Arrays.sort(s) Arrays.sort Arrays s if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        } s[0] == s[1] && s[1] != s[2] && s[2] == s[3] s[0] == s[1] && s[1] != s[2] && s[2] == s[3] s[0] == s[1] s[0] s 0 s[1] s 1 s[1] != s[2] s[1] s 1 s[2] s 2 s[2] == s[3] s[2] s 2 s[3] s 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" Scanner inp inp
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        char s[] = inp.next().toCharArray();
        Arrays.sort(s);
        if (s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}
