## Editorial for SAC '22 Code Challenge 4 P2 - Obligatory String Problem

**only**when stuck, and

**not to copy-paste code from it**. Please be respectful to the problem author and editorialist.

**Submitting an official solution before solving the problem yourself is a bannable offence.**

Author:

Define a function `int distance(string base, string to_grade)`

that returns the distance from `base`

to `to_grade`

.

The distance between each character can be determined with `a`

`z`

, where denotes the absolute value of , is the character from `base`

, and is the character from `to_grade`

.

Loop through all possibilities for the first character from `a`

to `z`

.

In that loop, loop through all possibilities for the second character from `a`

to `z`

.

In that loop, loop through all possibilities for the third character from `a`

to `z`

.

In that loop, loop through all possibilities for the fourth character from `a`

to `z`

.

Construct the string from these characters.

If the distance from this string to the base string is less than or equal to , output it.

**Time Complexity:**

## Comments