import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next().toUpperCase(); s sc.next().toUpperCase() sc.next().toUpperCase sc.next() sc.next sc char a[] = s.toCharArray(); a s.toCharArray() s.toCharArray s int count = 0 ; count 0 for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    } int j = 0 ; int j = 0 ; j 0 j<a.length j a.length a a.length j++ j++ j {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    } {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    } for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } int  i= 1+j; int  i= 1+j; i 1+j 1 j i<a.length i a.length a a.length i++ i++ i {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } if(a[j]==a[i]){
                 count++;
                   break ;
              } a[j]==a[i] a[j] a j a[i] a i {
                 count++;
                   break ;
              } count++ count break ; if(count==2)System.out.println("Yes");
        else System.out.println("No"); count==2 count 2 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 public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next().toUpperCase();
        char a[] = s.toCharArray();
         int count = 0 ;
        for(int j = 0 ; j<a.length ; j++)
        {
        for(int  i= 1+j; i<a.length ; i++)
        {
              if(a[j]==a[i]){
                 count++;
                   break ;
              }  
           
        } 
      
    }  
        if(count==2)System.out.println("Yes");
        else System.out.println("No");
 
 }
}
