Try it online! currently has 680 listed languages, all of which are searchable. For most of those languages, when searching for it, you don't have to enter the entire string. For example, entering lega
results in just 05AB1E (legacy) appearing, and entering d+
results in only Add++. However, for some languages, there is no such string that results in only that languages, e.g. Jelly
returns both Jelly
and Jellyfish
We will call the length of the shortest string required to return only a specific language on TIO the TIO uniqueness of that language. The TIO uniqueness of a language for which this is impossible is undefined. Note that TIO ignores case when searching, so bri
results in Brian & Chuck and SOM
results in Somme.
You are to take the name of a programming language on Try it online!, exactly as spelt in the search function, and return that language's TIO uniqueness. If the language's TIO uniqueness is undefined, you may instead return any value which is not a positive integer (or could reasonably be interpreted as a positive integer). This value need not be consistent between such languages. Your program should handle all 680 languages currently on TIO.
This is code-golf, so the shortest code wins. Standard loopholes are forbidden, especially internet access. You may also not access the file system of TIO. Essentially, your program should work whether it's run on TIO or locally.
Test cases
All test cases include the TIO uniqueness string in lowercase, as TIO is case insensitive in its search, and use 0 for undefined TIO uniquenesses
"Arcyóu" -> 1 ("ó")
"Befunge-98 (PyFunge)" -> 13 ("befunge-98 (p")
"Cauliflower" -> 3 ("cau")
"Shove" -> 3 ("hov")
"Funky" -> 0
",,," -> 2 (",,")
"Agony" -> 0
"Starry" -> 4 ("tarr")
"Add++" -> 2 ("d+")
"ATS2" -> 3 ("ts2")
"F# (.NET Core)" -> 5 ("f# (.")
"Dyvil" -> 2 ("yv")
"Python 3.8 (pre-release)" -> 2 ("3.")
The full list of names and the full list of test cases
"1"
instead of1
), it's fine to be output when the TIO uniqueness is undefined \$\endgroup\$