Alice and Strings
Tag(s):

Algorithms, Basics of String Manipulation, String, Very-Easy, strings

Problem
Editorial
Analytics

Two strings $A$ and $B$ comprising of lower case English letters are compatible if they are equal or can be made equal by following this step any number of times:

• Select a prefix from the string $A$ (possibly empty), and increase the alphabetical value of all the characters in the prefix by the same valid amount. For example if the string is $xyz$ and we select the prefix $xy$ then we can convert it to $yz$ by increasing the alphabetical value by 1. But if we select the prefix $xyz$ then we cannot increase the alphabetical value.

Your task is to determine if given strings $A$ and $B$ are compatible.

Input format

First line: String $A$

Next line: String $B$

Output format

For each test case, print $YES$ if string $A$ can be converted to string $B$ , otherwise print $NO$.

Constraints

$1 \le len(A) \le 1000000\\ 1 \le len(B) \le 1000000$

SAMPLE INPUT
abaca
cdbda
SAMPLE OUTPUT
YES
Explanation

The string $abaca$ can be converted to $bcbda$ in one move and to $cdbda$ in the next move.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

CODE EDITOR

Initializing Code Editor...

This Problem was Asked in Challenge Name

November Easy' 18

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Graphs
• Data Structures > Advanced Data Structures
• Data Structures > Trees
• Algorithms > Advanced Algorithms