import java.util.*;


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


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