import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    }
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc HashSet<Character> hs = new HashSet<>(); hs new HashSet<>() for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            hs.add(s.charAt(i));
        } {
            hs.add(s.charAt(i));
        } hs.add(s.charAt(i)) hs.add hs s.charAt(i) s.charAt s i String answer = "No"; answer "No" if (hs.size() == 2) {
            answer = "Yes";
        } hs.size() == 2 hs.size() hs.size hs 2 {
            answer = "Yes";
        } answer = "Yes" answer "Yes" System.out.println(answer) System.out.println System.out System System.out answer sc.close() sc.close sc String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    }
} Main
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        HashSet<Character> hs = new HashSet<>();
        for (int i = 0; i < s.length(); i++) {
            hs.add(s.charAt(i));
        }
        String answer = "No";
        // AとBの2種類あればYes、1種類だけならNo
        if (hs.size() == 2) {
            answer = "Yes";
        }
        System.out.println(answer);
        sc.close();
    }
}
