Amazon interview question

Program to check for string pattern a^nb^m where m!=n , m>0,n>0