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

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    }
} import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    } main {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc Set<String> set = new HashSet<>(); set new HashSet<>() for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        } char c s.toCharArray() s.toCharArray s {
            set.add(String.valueOf(c));
        } {
            set.add(String.valueOf(c));
        } set.add(String.valueOf(c)) set.add set String.valueOf(c) String.valueOf String c System.out.println(set.size() == 2 ? "Yes" : "No") System.out.println System.out System System.out set.size() == 2 ? "Yes" : "No" set.size() == 2 set.size() set.size set 2 "Yes" "No" String[] args args public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    }
} Main
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<String> set = new HashSet<>();
        for (char c : s.toCharArray()) {
            set.add(String.valueOf(c));
        }

        System.out.println(set.size() == 2 ? "Yes" : "No");
    }
}
