
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        char []S;
        int count=0;
        S=input.next().toCharArray();
        for(int i=0;i<3;i++)
        {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        }
        if(count==2)
        {
            System.out.println("Yes");
        }
        else
            System.out.println("No");
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        char []S;
        int count=0;
        S=input.next().toCharArray();
        for(int i=0;i<3;i++)
        {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        }
        if(count==2)
        {
            System.out.println("Yes");
        }
        else
            System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        char []S;
        int count=0;
        S=input.next().toCharArray();
        for(int i=0;i<3;i++)
        {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        }
        if(count==2)
        {
            System.out.println("Yes");
        }
        else
            System.out.println("No");
    } main {
        Scanner input=new Scanner(System.in);
        char []S;
        int count=0;
        S=input.next().toCharArray();
        for(int i=0;i<3;i++)
        {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        }
        if(count==2)
        {
            System.out.println("Yes");
        }
        else
            System.out.println("No");
    } Scanner input=new Scanner(System.in); input new Scanner(System.in) char []S; S int count=0; count 0 S=input.next().toCharArray() S input.next().toCharArray() input.next().toCharArray input.next() input.next input for(int i=0;i<3;i++)
        {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        } {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        } for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            } int j=i+1; int j=i+1; j i+1 i 1 j<4 j 4 j++ j++ j {
                if(S[i]==S[j])
                {
                    count++;
                }
            } {
                if(S[i]==S[j])
                {
                    count++;
                }
            } if(S[i]==S[j])
                {
                    count++;
                } S[i]==S[j] S[i] S i S[j] S j {
                    count++;
                } count++ count if(count==2)
        {
            System.out.println("Yes");
        }
        else
            System.out.println("No"); count==2 count 2 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args

import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        char []S;
        int count=0;
        S=input.next().toCharArray();
        for(int i=0;i<3;i++)
        {
            for(int j=i+1;j<4;j++)
            {
                if(S[i]==S[j])
                {
                    count++;
                }
            }
        }
        if(count==2)
        {
            System.out.println("Yes");
        }
        else
            System.out.println("No");
    }
}
