Input: a string, consisting of only printable ASCII characters
Output: a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from any starting point inside the string including wrap-around by going left-to-right
xyzabc would give a truthy result, because we could travel
xzy would give a falsey result, because all possible starting points (
z→x→y) are not in the correct order.
This sounds pretty simple, right? But there is one catch, as this is a restricted-source challenge: your program/function has to be in the correct order† as well.
- The input can be in any reasonable format. Can be a string, read from STDIN, a list of characters, etc. (No, you are not allowed to take a list of unicode values - which would basically be an integer list - unless your language does this conversion by default (i.e. Java (
charonly), Whitespace, etc.)
- The input is guaranteed to be printable ASCII (range \$[32,126]\$ /
- If your program/function is written in a different codepage, it does not necessary have to hold a truthy value when used as input for itself. The source code does need to be in the correct order based on the used codepage of course.
- The input is guaranteed to be non-empty. (An input of one or two characters will always result in a truthy output.)
- The input (and your source) can contain multiple of the same characters.
- This is code-bowlingcode-challenge, for which the longest answer counting only distinct bytes wins (i.e. if your source code is
ABBCabbc1223your score would be 9 for
- Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
- Default Loopholes are forbidden.
- If possible, please add a link with a test for your code (i.e. TIO).
- Also, adding an explanation for your answer is highly recommended.
~ ab ba ``` *5a Test test xyzabc aaabbbccc aaabbbCCC AAAbbbccc msuwy !#),-./0123:;<?@BCFGILMNOQTWX]^_bf oqqx}}~#$'''*+-./33489=?ABCHLQQQRTW[\]^_abcfgjkklmnno
xzy C-U TeSt tesT aaaBBBccc M3"b=J7Uh:kg&F~\p`GLx?9#!%XCOZBv.m_)Y4V*