import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io 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) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) A solver = new A(); solver new A() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    } A public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        } solve {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        } Set<Character> S = new HashSet<>(); S new HashSet<>() char[] a = in.next().toCharArray(); a in.next().toCharArray() in.next().toCharArray in.next() in.next in for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
                S.add(a[i]);
            } {
                S.add(a[i]);
            } S.add(a[i]) S.add S a[i] a i int ans = S.size(); ans S.size() S.size S boolean ok = false; ok false if (ans == 2) ok = true; ans == 2 ans 2 ok = true ok true out.println(ok ? "Yes" : "No") out.println out ok ? "Yes" : "No" ok "Yes" "No" int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        A solver = new A();
        solver.solve(1, in, out);
        out.close();
    }

    static class A {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            Set<Character> S = new HashSet<>();
            char[] a = in.next().toCharArray();
            for (int i = 0; i < a.length; i++) {
                S.add(a[i]);
            }
            int ans = S.size();

            // 出力
            boolean ok = false;
            if (ans == 2) ok = true;
            out.println(ok ? "Yes" : "No");

        }

    }
}

