import java.io.*;
import java.io.BufferedReader;

public class lexAnalyser
{
  static String state;
    public static void main( String[] args ) throws IOException{
    
         boolean match=true;//boolean for checking if the string in matched
  BufferedReader stdin = new BufferedReader(
    new InputStreamReader(System.in));

while(true){  
  System.out.println("Enter a word to match or press ENTER to exit");
   String word= stdin.readLine();
 if(word.length()>0)
     analyze(word);
 else
     break;  //terminate the program 
   
   }
 
 
    }
       static String a;
       static String b;
      public static void  analyze(String word){
       String temp= word.trim();// remove empty spaces at the end of the string
       int i = 0;
       boolean matcher = false;
        for(i=0;i<temp.length();i++)
         
        {
       char ch= temp.charAt(i); 
       
       if(ch=='a'){ 
        state = a;
        if(i== (temp.length()-1))
        {
          matcher = false;
        }
       }
       else
       {
         if(ch =='b')
         {
           if(!(i==(temp.length()-1)))
           {
             matcher = false;
             break;
           }
           else matcher = true;
         }
         else
           matcher = false;
         break;
       }
        }
       
             
        
      
     if(!matcher) {
         System.out.println("NO-the given string is not matched");
            System.out.println("------------------------------");
        
          }
       
       
  if(matcher) {    
  System.out.println("YES-the given string is matched");
  System.out.println("-------------------------------");
      
     }
    
   }

}