import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc char[] lis = new char[256]; lis new char[256] 256 for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        } int i = 0; int i = 0; i 0 i < 4 i 4 ++i ++i i {
            lis[s.charAt(i)] += 1;
        } {
            lis[s.charAt(i)] += 1;
        } lis[s.charAt(i)] += 1 lis[s.charAt(i)] lis s.charAt(i) s.charAt s i 1 for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        } int i = 0; int i = 0; i 0 i < 256 i 256 ++i ++i i {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        } {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        } if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            } lis[i] != 0 && lis[i] != 2 lis[i] != 0 lis[i] lis i 0 lis[i] != 2 lis[i] lis i 2 {
                System.out.println("No");
                return;
            } System.out.println("No") System.out.println System.out System System.out "No" return; System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        char[] lis = new char[256];

        for (int i = 0; i < 4; ++i) {
            lis[s.charAt(i)] += 1;
        }
        for (int i = 0; i < 256; ++i) {
            if (lis[i] != 0 && lis[i] != 2) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}

