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<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.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<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.size() == 2 ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.size() == 2 ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.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<Integer> ch = new HashSet<Integer>(); ch new HashSet<Integer>() for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            ch.add((int) s.charAt(i));
        } {
            ch.add((int) s.charAt(i));
        } ch.add((int) s.charAt(i)) ch.add ch (int) s.charAt(i) s.charAt s i System.out.println(ch.size() == 2 ? "Yes" : "No") System.out.println System.out System System.out ch.size() == 2 ? "Yes" : "No" ch.size() == 2 ch.size() ch.size ch 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<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.size() == 2 ? "Yes" : "No");
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        Set<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.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<Integer> ch = new HashSet<Integer>();
        for (int i = 0; i < s.length(); i++) {
            ch.add((int) s.charAt(i));
        }
        System.out.println(ch.size() == 2 ? "Yes" : "No");
    }
}
