49
\$\begingroup\$

The challenge is simple:

Write a function or program that takes an input x, and outputs the lower case alphabet if x is part of the lower case alphabet, outputs the upper case alphabet if x is part of the upper case alphabet and outputs just x if it's not part of either.

Rules:

  • The input can be function argument or from STDIN
  • The input will be any of the printable ASCII characters from 32 to 126 (space to tilde).
  • The input may be inside quotation marks,'x' or "x", but remember that ' and " are valid input and should be supported.
  • The input can be any of the letters in the alphabet, i.e. you can't assume it will be a or A.
  • The output should be only one of the alphabets or the single symbol, but trailing newlines are OK.
  • The letters in the alphabet should not be separated by spaces, commas or anything else.

Some examples:

F
ABCDEFGHIJKLMNOPQRSTUVWXYZ

z
abcdefghijklmnopqrstuvwxyz

"
"

    <- Input:  Space
    <- Output: Space

Shortest code in bytes win.


Optional but appreciated: If your language has an online interpreter, please also post a link so that it can be easily tested by others.


Leaderboard

The Stack Snippet at the bottom of this post generates the catalog from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

## Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

## Ruby, <s>104</s> <s>101</s> 96 bytes

If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the last number in the header:

## Perl, 43 + 2 (-p flag) = 45 bytes

You can also make the language name a link which will then show up in the snippet:

## [><>](http://esolangs.org/wiki/Fish), 121 bytes

var QUESTION_ID=67357,OVERRIDE_USER=44713;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/<a/.test(o)&&(o=jQuery(o).text()),s[o]=s[o]||{lang:e.language,user:e.user,size:e.size,link:e.link}});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){return e.lang>s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>

\$\endgroup\$
  • \$\begingroup\$ Are we allowed to import packages like, in Python for example: import Random and then use Random.randint (obviously not for this challenge but still)? \$\endgroup\$ – Daniel Dec 22 '15 at 15:28
  • \$\begingroup\$ Yes, you may import packages. but the bytes for writing for instance import string are counted, thus it's often better to do workarounds. Note that the package must exist before the challenge is posted. Many challenges have something like: "Using packages that does this is not allowed", but that is not the case in this challenge. \$\endgroup\$ – Stewie Griffin Dec 22 '15 at 15:36
  • \$\begingroup\$ I'm assuming that by "quotes are valid input and must be supported" you mean that if your input method requires quotes then quotes as input would be escaped \$\endgroup\$ – Cyoce Dec 23 '15 at 5:10
  • \$\begingroup\$ May we assume a REPL environment? \$\endgroup\$ – cat Dec 23 '15 at 17:38

65 Answers 65

2
\$\begingroup\$

Brachylog, 8 bytes

∈Ạ|ḷ∈Ạụ|

Try it online!

∈Ạ          The input is a member of the lowercase alphabet,
  |         which is output, or
   ḷ∈Ạ      the input lowercased is a member of the lowercase alphabet,
      ụ|    which is output uppercased, or the input is output.

It'd be two bytes shorter if we had a constant for the uppercase alphabet but we don't :(

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Gema, 60 characters

\A=@set{a;abcdefghijklmnopqrstuvwxyz}
<J>=$a
<K>=@upcase{$a}

Sample run:

bash-4.3$ gema '\A=@set{a;abcdefghijklmnopqrstuvwxyz};<J>=$a;<K>=@upcase{$a}' <<< 'm'
abcdefghijklmnopqrstuvwxyz

bash-4.3$ gema '\A=@set{a;abcdefghijklmnopqrstuvwxyz};<J>=$a;<K>=@upcase{$a}' <<< 'W'
ABCDEFGHIJKLMNOPQRSTUVWXYZ

bash-4.3$ gema '\A=@set{a;abcdefghijklmnopqrstuvwxyz};<J>=$a;<K>=@upcase{$a}' <<< '@'
@
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Seriously, 17 bytes

    ;;ú(úíuIúû;(@íuI

Hex Dump:

093b3ba328a3a17549a3963b2840a17549

Try It Online

Given that it pretty much just reads in an unformatted byte, checks if it's in the lowercase alphabet, then checks if it's in the uppercase alphabet, the automatic documentation given in the link is sufficient. (Note, however, that the documentation for í has the argument order reversed; it pops the sequence first.)

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Sed, 61 characters

(60 characters code + 1 character command line option)

s/[a-z]/&abcdefghijklmnopqrstuvwxyz/i
s/[A-Z].*/\U&/
T
s/.//

Sample run:

bash-4.3$ sed -r 's/[a-z]/&abcdefghijklmnopqrstuvwxyz/i;s/[A-Z].*/\U&/;T;s/.//' <<< 'm'
abcdefghijklmnopqrstuvwxyz

bash-4.3$ sed -r 's/[a-z]/&abcdefghijklmnopqrstuvwxyz/i;s/[A-Z].*/\U&/;T;s/.//' <<< 'W'
ABCDEFGHIJKLMNOPQRSTUVWXYZ

bash-4.3$ sed -r 's/[a-z]/&abcdefghijklmnopqrstuvwxyz/i;s/[A-Z].*/\U&/;T;s/.//' <<< '@'
@
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Python 2, 67 bytes

f=lambda c,i=26:c[c.isalpha():]or c*i and f(c,i-1)+chr(i^ord(c)&96)

For letter inputs, generates the string of letters recursively. Doing ord(c)&96 removes the 5 high bits, and the xor'ing the values i from 1 to 26 gives the letter char codes. For control flow, we count i down, adding new letters to the end, stopping when i=0. When the input c is not a letter, immediately outputs it and stops.

Thanks to Mauris for 2 bytes.

Previous solution (68):

lambda c:[c,str(bytearray(range(ord(c)&96,255)[1:27]))][c.isalpha()]
|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ The input will be any of the printable ASCII characters from 32 to 126 (space to tilde). Wouldn't ord(c)&96 suffice, then? \$\endgroup\$ – Lynn Dec 22 '15 at 21:42
  • \$\begingroup\$ @Mauris Yes, good call. \$\endgroup\$ – xnor Dec 22 '15 at 21:47
  • \$\begingroup\$ I think '_' --> c works and saves a byte in your recursive solution. \$\endgroup\$ – Lynn Dec 22 '15 at 22:02
1
\$\begingroup\$

Python 2.7, 88 bytes (incl. print)

from string import*
def f(c):print[c,uppercase,c,lowercase,c][sorted('@Z`z'+c).index(c)]
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Mouse-2002, 125 bytes

... or 126 bytes if I can't assume a REPL envrironment (which assumes a $ at the end of the program; the non-REPL interpreter crashes without one)

An attempt at code deduplication... probably a failed one.

Golfed:

?'a:123b:a.65<a.31>*1=a.90>a.97<*1=+a.122>+1=[a.!']a.63>a.91<*1=[65i:(i.91<^i.!'i.1+i:)]a.96>a.b.<*1=[97i:(i.b.<^i.!'i.1+i:)]

Ungolfed:

?' a:                    ~ a = getchar();
123 b:                   ~ b = 123
a. 65 <                  ~ return whether a < 65
a. 31 >                  ~ same for 31
  * 1 =                    ~ AND
a. 90 >                  ~ a > 90 ?
a. 97 <                  ~ a < 97 ?
  * 1 =                    ~ AND
+                          ~ OR
a.122 >                  ~ a > 122 ?
  + 1 =                    ~ OR
[                          ~ if 1
  a.!'                       ~ print ascii codepoint
]                          ~ fi
a. 63 >                  ~ a > 63 ?
a. 91 <                  ~ a < 91 ?
  * 1 =                    ~ AND
[                          ~ if 1
  65 i:                      ~ for i = 65;
  (                          ~ do;
    i. 91 < ^                  ~ i < 91;
    i.!'                       ~ print(charAt(i));
    i. 1+ i:                   ~ i++;
  )                         ~ done;
]                          ~ fi
a. 96 >                  ~ a > 96 ?
a. b. <                  ~ a < b ?
  * 1 =                    ~ AND
[                          ~ if 1
  97 i:                      ~ for i = 97;
  (                          ~ do;
    i. b. < ^                  ~ i < 91; 
    i.!'                       ~ print(charAt(i));
    i. 1+ i:                   ~ i++;
  )                          ~ done;
]                          ~ fi
$                        ~ \bye
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

JavaScript (ES6), 99 87 79 78 bytes

x=>(y='abcdefghijklmnopqrstuvwxyz',parseInt(x,36)>9?x>'`'?y:y.toUpperCase():x)

Uses the short array fill trick to allocate space, then just math and String.fromCharCode to get the alphabet. Thought it would be shorter until I realized the rule about non-alphabet characters. parseInt turned out to be helpful in determining if the character was in the alphabet.

Test

var F=x=>(y='abcdefghijklmnopqrstuvwxyz',parseInt(x,36)>9?x>'`'?y:y.toUpperCase():x)
x = <input type="text" oninput="result.textContent=this.value?F(this.value):''" />
<pre id="result"></pre>

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Ruby, 56+2 = 58 bytes

2 bytes for -p flag

c=$_[0]
[?a..?z,?A..?Z].map{|r|r===c&&c=r.to_a.join}
p c

Ungolfed version (no -p flag)

while true
  char = gets.chars.first
  [("a".."z"),("A".."Z")].each do |range|
    char = range.to_a.join("") if range.include? char
  end
  p char
end
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

s-lang, 40 bytes (non-competing)

Replaces any letter with the alphabet, matching the case.

t@[[a-z]][abcdefghijklmnopqrstuvwxyz]
  • t Replace with regex function
  • @ Match case for entire match parameter for t function
  • [[a-z]] first argument ([a-z]) regex for matching any letter (@ parameter makes it so this function ignores the case when matching, so we don't need A-Z too)
  • abcdefghijklmnopqrstuvwxyz what to replace it with

Try it here

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Java 7, 99 bytes

void f(char c){for(int a=c|32,i=97;i<123;i++)System.out.print(a<123&a>96?(char)(i-a+c):i<98?c:"");}

Slightly more readable, with no scrollbars:

void f(char c){
    for(int a=c|32,i=97;i<123;i++)  // a is lowercased input, i loops alphabet 
        System.out.print(           
            a<123&a>96?             // if a is a letter
                (char)(i-a+c):      //   subtract diff between lower and input
                    i<98?c:"");     // else print input if first iteration
}

The logic here is pretty straightforward, but a different method than the other Java answer.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Perl 6, 50

{join "",/<:Lu>/??"A".."Z"!!/<:Ll>/??"a".."z"!!$_}
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

PHP, 60 bytes

for(ctype_alpha($c=$argn)?$c=$c&a|A:$z=25;$z++<26;)echo$c++;

Run as pipe with -R.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Recursiva, 13 bytes

||&N(a(&N)a)a

Try it online!

Explanation:

This roughly translates to 'N(a and (' or 'N)a and )' or a. N(a checks if a is in (. ( and ) are upper and lower-case alphabet yield.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Ly, 32 bytes

"AZ"Ris~[p&o;]&p"az"Rl~[p&o;]lo;

Try it online!

Explanation:

"AZ"Ris~[p&o;]&p"az"Rl~[p&o;]lo;

     is                          # take input and save it
"AZ"R  ~[    ]                   # is it in the uppercase alphabet?
         p&o;                    # output the stack, terminate
              &p                 # clear stack
                     l           # load input
                "az"R ~[    ]    # is it in the lowercase alphabet?
                        p&o;     # output the stack, terminate
                             lo; # output the input, terminate
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Python 2, 73 bytes

c=ord(input())
print[chr(c),bytearray(range(c&96|1,c&96|27))][64<c&95<91]

Try it online!

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

APL (Dyalog), 22 bytes

Unnamed prefix lambda.

{⊃a/⍨⍵∊¨a←⎕A(819⌶⎕A)⍵}

Try it online!

{} anonymous function where represents the argument:

⎕A(819⌶⎕A)⍵ uppercase Alphabet, lowercased Alphabet, argument

a← store in a (for all)

⍵∊¨ three Booleans for argument's membership of each those

a/⍨ filter a by that

 pick the first

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

APL (Dyalog Unicode), 26 24 bytes

t←{⍵∊g←819⌶f←⎕A:g⋄⍵∊f:f⋄⍵}

Try it online!

The byte count does not include t← because it's not necessary, it just assigns the function to t (so you can call it by using t input).

If input is not a number, it needs to be enclosed in single quotes. For the input ', you need to escape it by typing it twice (so the call is t '''')

Thanks to @Adám for 2 bytes.

How it works:

{⍵∊g←819⌶f←⎕A:g⋄⍵∊f:f⋄⍵} ⍝ Main function
             :            ⍝ if
         f←⎕A             ⍝ Assigns the uppercase alphabet to f
   g←819⌶                 ⍝ Assigns the I-Beam command 819 (case convert) over the uppercase alphabet (f) to g
 ⍵∊                       ⍝ The right argument 'is in' the lowercase alphabet
              g           ⍝ then print g (the lowercase alphabet)
               ⋄   :      ⍝ else if
                ⍵∊f       ⍝ the right argument 'is in' f (the uppercase alphabet)           
                    f     ⍝ print f
                     ⋄⍵   ⍝ else, print the right argument.
|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

C (gcc), 94 bytes

#define f(c)isupper(c)?"ABCDEFGHIJKLMNOPQRSTUVWXYZ":islower(c)?"abcdefghijklmnopqrstuvwxyz":&c

#define f(c) is like declaring a function f that takes a variable c.

isupper(c) checks if c is an uppercase letter, returns the uppercase alphabet if so. Otherwise, it checks if it's lowercase. If so, it returns the lowercase alphabet. Otherwise, it returns a pointer to c, which can be printed as a string (since you must pass a char or int to f).

Try it online!

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ Is it possible to store the alphabet in a variable and use toupper in here (I don't know C) \$\endgroup\$ – Stewie Griffin Nov 17 '17 at 8:04
  • \$\begingroup\$ @StewieGriffin toupper only works on chars, and strtoupper/strupper is not standard C (nor implemented on many systems). \$\endgroup\$ – MD XF Nov 17 '17 at 16:53
1
\$\begingroup\$

Noether, 40 bytes

{0A~bI~a/~c}{bP}b{Ua/~d}{bUP}1{cd|-}{aP}

Try it online!

Uses Noether's built-in constant function A to return the string abcdefghijklmnopqrstuvwxyx.

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

R, 80 bytes

s=(r=65:90)+32
a=utf8ToInt(scan(,''));intToUtf8("if"(a%in%r,r,"if"(a%in%s,s,a)))

Try it online!

-1 byte thanks to Giuseppe. Still not the golfiest way (see here). Similar ideas include:

R, 87 bytes

f=function(x,y)"if"(a%in%x,x,y)
a=utf8ToInt(scan(,''));intToUtf8(f(r<-65:90,f(r+32,a)))

Try it online!

a=utf8ToInt(scan(,''));intToUtf8("if"(a%in%c(32:64,91:96,123:126),a,65:90+32*(a>90)))

and my favorite:

a=utf8ToInt(scan(,''));intToUtf8(c(a,65:90+32*(a>90))[2*a%in%c(32:64,91:96,123:126)-1])

and inspired by the other R solution (same bytecount):

"+"=function(x,y)"if"(a%in%x,x,y)
a=scan(,'');cat(letters+LETTERS+a,sep="")

Try it online!

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ 80 bytes \$\endgroup\$ – Giuseppe Aug 9 '18 at 13:44
  • \$\begingroup\$ @Giuseppe thanks! \$\endgroup\$ – JayCe Aug 9 '18 at 13:55
1
\$\begingroup\$

C# .NET, 193 bytes

class P{static void Main(string[]a){var z="ABCDEFGHIJKLMNOPQRSTUVWXYZ";var b=a[0];System.Console.Write(b.Length>1?b:z.IndexOf((b[0]))>-1?z:z.ToLower().IndexOf((b[0]))>-1?z.ToLower():b[0]+"");}}

Try Online EDIT: Variable assignment with if statements is stupid

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Zsh, 75 bytes

l=${(j::):-{a..z}} u=$l:u
<<<${${${l:#*$1*}:+${${${u:#*$1*}:+$1}:-$u}}:-$l}

l=${(j::):-{a..z}}                                  # set l to the (j::)oined lowercase
                   u=$l:u                           # set u to :uppercase'd l
<<<${${${l:#*$1*}:+${${${u:#*$1*}:+$1}:-$u}}:-$l}
       ${l:#*$1*}                                   # remove *$1* from $l (is empty if $1 is lower)
     ${          :+                        }        # If non-empty, then...
                       ${u:#*$1*}                   # remove *$1* from $u (is empty if $1 is upper)
                     ${          :+$1}              # If non-empty, substitute $1
                   ${                 :-$u}         # If empty, substitute $u
    ${                                       :-$l}  # If empty, substitute $l

Try it online!

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Python 3, 84 bytes

lambda x,a='abcdefghijklmnopqrstuvwxyz':[x,a,a.upper()][(x in a)+2*(x in a.upper())]

Try it online!

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Wolfram Language (Mathematica), 62 bytes

""<>(#/.Join[a=Alphabet[];A=ToUpperCase@a;#->a&/@a,#->A&/@A])&

Try it online!

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Python 3, 93 bytes

i=input();a="abcdefghijklmnopqrstuvwxyz";A=a.upper();print(i in a and a or i in A and A or i)

Under 100 bytes!

|improve this answer|||||
\$\endgroup\$
1
\$\begingroup\$

Keg, -ir 45 37 21 bytes

:AZ"•[_AZɧ|:az"•[_azɧ

Try it online!

-16 bytes due to using ranges

Answer History

37 bytes

::`>$\~<*[_z(|:;)^|:A1->[_Z(|:;)^|,

-8 bytes thanks to A__

Try it online!

|improve this answer|||||
\$\endgroup\$
  • \$\begingroup\$ 37B by using control characters. \$\endgroup\$ – user85052 Aug 21 '19 at 22:55
0
\$\begingroup\$

k4, 24 bytes

{*b@&x in/:b:(.Q`A`a),x}

Another port of the Pyth answer—constructs a list of upper, lower, and the arg, and returns the first one that contains the arg.

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

Sprects, 207 bytes

|<CHAR>|ZA|YA|XA|WA|VA|UA|TA|SA|RA|QA|PA|OA|NA|MA|LA|KA|JA|IA|HA|GA|FA|EA|DA|CA|BA|AABCDEFGHIJKLMNOPQRSTUVWXYZ|za|ya|xa|wa|va|ua|ta|sa|ra|qa|pa|oa|na|ma|la|ka|ja|ia|ha|ga|fa|ea|da|ca|ba|aabcdefghijklmnopqrstuvwxyz

Enter character on <CHAR>.

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

AWK 104 bytes

/[a-z]/{print"abcdefghijklmnopqrstuvwxyz"}
/[A-Z]/{print"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
/[^A-z]/{print$0}
|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.