import java.util.Scanner;


public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
} import java.util.Scanner; Scanner java.util public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc char[] ca = str.toCharArray(); ca str.toCharArray() str.toCharArray str int[] count = new int[4]; count new int[4] 4 for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        } int i =0; int i =0; i 0 i < ca.length i ca.length ca ca.length i++ i++ i {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        } {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        } for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            } char c ca {
                if (c == ca[i]) {
                    count[i]++;
                }
            } {
                if (c == ca[i]) {
                    count[i]++;
                }
            } if (c == ca[i]) {
                    count[i]++;
                } c == ca[i] c ca[i] ca i {
                    count[i]++;
                } count[i]++ count[i] count i boolean key = true; key true for (int c:count) {
            if (c != 2) {
                key = false;
            }
        } int c count {
            if (c != 2) {
                key = false;
            }
        } {
            if (c != 2) {
                key = false;
            }
        } if (c != 2) {
                key = false;
            } c != 2 c 2 {
                key = false;
            } key = false key false if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } key {
            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" String[] args args public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
} public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
} Main
import java.util.Scanner;


public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] ca = str.toCharArray();
        int[] count = new int[4];
        for (int i =0; i < ca.length; i++) {
            for (char c : ca) {
                if (c == ca[i]) {
                    count[i]++;
                }
            }
        }
        boolean key = true;
        for (int c:count) {
            if (c != 2) {
                key = false;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
        
    }
}