
// 問題URL
// https://atcoder.jp/contests/abc132/tasks/abc132_a

import java.util.Scanner;
import java.util.Arrays;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.stream.*; stream.* java.util public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} Main public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } main {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String x = scanner.next(); x scanner.next() scanner.next scanner String[] ar = x.split(""); ar x.split("") x.split x "" int count = 0; count 0 int no_count = 0; no_count 0 for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        } int i = 0; int i = 0; i 0 i< ar.length i ar.length ar ar.length i++ i++ i {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        } {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        } String s = ar[i]; s ar[i] ar i for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            } int j = 0; int j = 0; j 0 j < ar.length j ar.length ar ar.length j++ j++ j {
                if (s.equals(ar[j])) count++;
            } {
                if (s.equals(ar[j])) count++;
            } if (s.equals(ar[j])) count++; s.equals(ar[j]) s.equals s ar[j] ar j count++ count if(count >= 2) break; count >= 2 count 2 break; count = 0 count 0 for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        } int i = 0; int i = 0; i 0 i< 4 i 4 i++ i++ i {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        } {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        } if(ar[i].equals(ar[0])) no_count++; ar[i].equals(ar[0]) ar[i].equals ar[i] ar i ar[0] ar 0 no_count++ no_count if(ar[i].equals(ar[1])) no_count++; ar[i].equals(ar[1]) ar[i].equals ar[i] ar i ar[1] ar 1 no_count++ no_count if(ar[i].equals(ar[2])) no_count++; ar[i].equals(ar[2]) ar[i].equals ar[i] ar i ar[2] ar 2 no_count++ no_count if(ar[i].equals(ar[3])) no_count++; ar[i].equals(ar[3]) ar[i].equals ar[i] ar i ar[3] ar 3 no_count++ no_count if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } count >= 2 && no_count == 8 count >= 2 count 2 no_count == 8 no_count 8 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
} Main

// 問題URL
// https://atcoder.jp/contests/abc132/tasks/abc132_a

import java.util.Scanner;
import java.util.Arrays;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] ar = x.split("");
        int count = 0;
        int no_count = 0;

        for(int i = 0; i< ar.length; i++) {
            String s = ar[i];
            for(int j = 0; j < ar.length; j++) {
                if (s.equals(ar[j])) count++;
            }
            if(count >= 2) break;
            count = 0;
        }

        for(int i = 0; i< 4; i++) {
            if(ar[i].equals(ar[0])) no_count++;
            if(ar[i].equals(ar[1])) no_count++;
            if(ar[i].equals(ar[2])) no_count++;
            if(ar[i].equals(ar[3])) no_count++;
        }

        if(count >= 2 && no_count == 8) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}