Take the square root of a string Motivation

In this challenge your task was to multiply two strings, this naturally introduces a way to take the square root of a string.

How does it work?

Given a string (for example pub) the first thing you need to do, is to determine the ASCII code for each character:

"pub" -&gt; [112, 117, 98]


Next you map these codes to the range [0..94] by subtracting 32 of each value:

[112, 117, 98] -&gt; [80, 85, 66]


Now you need to find for each value its root modulo 95 (eg. 40*40 % 95 = 80, you could also pick 55):

[80, 85, 66] -&gt; [40, 35, 16]


And finally you'll map it back to the range [32..126] and convert it back to a string:

[40, 35, 16] -&gt; [72, 67, 48] -&gt; "HC0"


Indeed "HC0" ⊗ "HC0" = "pub" as you can verify with a solution from the other challenge here.



The ones familiar with modular arithmetic probably noticed that the square root modulo 95 does not always exist, for example there's no root for 2. In such a case the square root of a string is not defined and your program/function may crash, loop indefinetly etc.

For your convenience, here's the list of chars that have a square root (the first one is a space):

 !$%&amp;)+03489:&gt;CDGLMQVW]`bjlpqu


Rules


You will write a program/function that takes a string (or list of chars) as an argument and returns any square root if it exists
You may assume that the input always has a square root
The input may consist of an empty string
The input will be in the printable range ([32..126])
The output is either printed to the console or you return a string if the square root exists
In case the square root doesn't exist, the behavior of your program/function is left undefined
If you choose to print the root to the console trailing newlines or whitespaces are fine


Test cases

Note that these are not necessarily the only solutions:

''              -&gt; ''
'pub'           -&gt; 'HC0'
'pull!'         -&gt; 'HC33!'
'M&gt;&gt;M'          -&gt; '&gt;MM&gt;'
'49'            -&gt; '4%'
'64'            -&gt; undefined
'Hello, World!' -&gt; undefined
sh + coreutils, 58 bytes



tr '$%&amp;)+0389:&gt;CDGLMQVW]`bjpqu' 1u.#:BFO%+M/L2Aa,795d0@H=C


Try it online!

The modular square root is typically not unique; we have 2 or 4 choices for each character except .  We don’t need to translate , !, 4, l since each is already a square root of itself.  For the remaining characters, we choose images that don’t need to be escaped for the shell or tr.