• + 5 comments

    This is really nice solution. Just one problem though(assuming above code is in JAVA ) if you give input bac , b . It still returns NO . check should be (not equal to -1). This will fix the problem.