<p>You are given a <strong>0-indexed</strong> string <code>s</code>, a string <code>a</code>, a string <code>b</code>, and an integer <code>k</code>.</p> <p>An index <code>i</code> is <strong>beautiful</strong> if:</p> <ul> <li><code>0 <= i <= s.length - a.length</code></li> <li><code>s[i..(i + a.length - 1)] == a</code></li> <li>There exists an index <code>j</code> such that: <ul> <li><code>0 <= j <= s.length - b.length</code></li> <li><code>s[j..(j + b.length - 1)] == b</code></li> <li><code>|j - i| <= k</code></li> </ul> </li> </ul> <p>Return <em>the array that contains beautiful indices in <strong>sorted order from smallest to largest</strong></em>.</p> <p> </p> <p><strong class="example">Example 1:</strong></p> <pre> <strong>Input:</strong> s = "isawsquirrelnearmysquirrelhouseohmy", a = "my", b = "squirrel", k = 15 <strong>Output:</strong> [16,33] <strong>Explanation:</strong> There are 2 beautiful indices: [16,33]. - The index 16 is beautiful as s[16..17] == "my" and there exists an index 4 with s[4..11] == "squirrel" and |16 - 4| <= 15. - The index 33 is beautiful as s[33..34] == "my" and there exists an index 18 with s[18..25] == "squirrel" and |33 - 18| <= 15. Thus we return [16,33] as the result. </pre> <p><strong class="example">Example 2:</strong></p> <pre> <strong>Input:</strong> s = "abcd", a = "a", b = "a", k = 4 <strong>Output:</strong> [0] <strong>Explanation:</strong> There is 1 beautiful index: [0]. - The index 0 is beautiful as s[0..0] == "a" and there exists an index 0 with s[0..0] == "a" and |0 - 0| <= 4. Thus we return [0] as the result. </pre> <p> </p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= k <= s.length <= 10<sup>5</sup></code></li> <li><code>1 <= a.length, b.length <= 10</code></li> <li><code>s</code>, <code>a</code>, and <code>b</code> contain only lowercase English letters.</li> </ul>