
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        char[] c = s.toCharArray();
        Arrays.sort(c);
        System.out.println(c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No");
    }
} import java.util.*; util.* java class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        char[] c = s.toCharArray();
        Arrays.sort(c);
        System.out.println(c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        char[] c = s.toCharArray();
        Arrays.sort(c);
        System.out.println(c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No");
    } main {
        Scanner stdIn = new Scanner(System.in);
        String s = stdIn.next();
        char[] c = s.toCharArray();
        Arrays.sort(c);
        System.out.println(c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No");
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) String s = stdIn.next(); s stdIn.next() stdIn.next stdIn char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s Arrays.sort(c) Arrays.sort Arrays c System.out.println(c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No") System.out.println System.out System System.out c[0] == c[1] && c[2] == c[3] && c[0] != c[2] ? "Yes" : "No" c[0] == c[1] && c[2] == c[3] && c[0] != c[2] c[0] == c[1] && c[2] == c[3] && c[0] != c[2] c[0] == c[1] c[0] c 0 c[1] c 1 c[2] == c[3] c[2] c 2 c[3] c 3 c[0] != c[2] c[0] c 0 c[2] c 2 "Yes" "No" String[] args args

import java.util.*;

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