<p>You are given two strings, pattern and value. The pattern string consists of just the letters a and b, describing a pattern within a string. For example, the string catcatgocatgo matches the pattern aabab (where cat is a and go is b). It also matches patterns like a, ab, and b. Write a method to determine if value matches pattern. a and b cannot be the same string.</p>
<p><strong>Example 1: </strong></p>
<pre>
<strong>Input: </strong> pattern = "abba", value = "dogcatcatdog"
<strong>Output: </strong> true
</pre>
<p><strong>Example 2: </strong></p>
<pre>
<strong>Input: </strong> pattern = "abba", value = "dogcatcatfish"
<strong>Output: </strong> false
</pre>
<p><strong>Example 3: </strong></p>
<pre>
<strong>Input: </strong> pattern = "aaaa", value = "dogcatcatdog"
<strong>Output: </strong> false
</pre>
<p><strong>Example 4: </strong></p>
<pre>
<strong>Input: </strong> pattern = "abba", value = "dogdogdogdog"