47
\$\begingroup\$

Write a program that outputs its input unchanged. However:

  • If all uppercase characters are removed from the program, it lowercases all uppercase letters.
  • If all lowercase characters are removed from the program, it uppercases all lowercase letters.

Transforming characters beyond the basic Latin [A-Za-z] range is optional, but any character with both uppercase and lowercase counterparts within Unicode (Ñ/ñ, Ω/ω, etc.) qualifies for "removal" from your program.

In your answer, please specify the character encoding used along with the language name if it might be ambiguous.

This is . The less bytes, the better.


Here's an example in a hypothetical programming language, with input "Hello, world!":

DONT_do_NOT_lowercase_UPPERCASE_this(_MY_input_STRING_)

Hello, world!

With uppercase characters removed:

_do__lowercase__this(__input__)

hello, world!

With lowercase characters removed:

DONT__NOT__UPPERCASE_(_MY__STRING_)

HELLO, WORLD!


To be complete, here are the characters/Unicode codepoints that can be removed:

Uppercase Characters

ABCDEFGHIIJKLMNOPQRSTUVWXYZµÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßĀĂĄĆĈĊČĎĐĒĔĖĘĚĜĞĠĢĤĦĨĪĬĮİİIJĴĶĹĻĽĿŁŃŅŇʼnŊŌŎŐŒŔŖŘŚŜŞŠŢŤŦŨŪŬŮŰŲŴŶŸŹŻŽſƁƂƄƆƇƉƊƋƎƏƐƑƓƔƖƗƘƜƝƟƠƢƤƦƧƩƬƮƯƱƲƳƵƷƸƼDŽDžLJLjNJNjǍǏǑǓǕǗǙǛǞǠǢǤǦǨǪǬǮǰDZDzǴǶǷǸǺǼǾȀȂȄȆȈȊȌȎȐȒȔȖȘȚȜȞȠȢȤȦȨȪȬȮȰȲȺȻȽȾɁɃɄɅɆɈɊɌɎͅͰͲͶͿΆΈΉΊΌΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫΰςϏϐϑϕϖϘϚϜϞϠϢϤϦϨϪϬϮϰϱϴϵϷϹϺϽϾϿЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯѠѢѤѦѨѪѬѮѰѲѴѶѸѺѼѾҀҊҌҎҐҒҔҖҘҚҜҞҠҢҤҦҨҪҬҮҰҲҴҶҸҺҼҾӀӁӃӅӇӉӋӍӐӒӔӖӘӚӜӞӠӢӤӦӨӪӬӮӰӲӴӶӸӺӼӾԀԂԄԆԈԊԌԎԐԒԔԖԘԚԜԞԠԢԤԦԨԪԬԮԱԲԳԴԵԶԷԸԹԺԻԼԽԾԿՀՁՂՃՄՅՆՇՈՉՊՋՌՍՎՏՐՑՒՓՔՕՖևႠႡႢႣႤႥႦႧႨႩႪႫႬႭႮႯႰႱႲႳႴႵႶႷႸႹႺႻႼႽႾႿჀჁჂჃჄჅჇჍᏸᏹᏺᏻᏼᏽᲀᲁᲂᲃᲄᲅᲆᲇᲈᲐᲑᲒᲓᲔᲕᲖᲗᲘᲙᲚᲛᲜᲝᲞᲟᲠᲡᲢᲣᲤᲥᲦᲧᲨᲩᲪᲫᲬᲭᲮᲯᲰᲱᲲᲳᲴᲵᲶᲷᲸᲹᲺᲽᲾᲿḀḂḄḆḈḊḌḎḐḒḔḖḘḚḜḞḠḢḤḦḨḪḬḮḰḲḴḶḸḺḼḾṀṂṄṆṈṊṌṎṐṒṔṖṘṚṜṞṠṢṤṦṨṪṬṮṰṲṴṶṸṺṼṾẀẂẄẆẈẊẌẎẐẒẔẖẗẘẙẚẛẞẞẠẢẤẦẨẪẬẮẰẲẴẶẸẺẼẾỀỂỄỆỈỊỌỎỐỒỔỖỘỚỜỞỠỢỤỦỨỪỬỮỰỲỴỶỸỺỼỾἈἉἊἋἌἍἎἏἘἙἚἛἜἝἨἩἪἫἬἭἮἯἸἹἺἻἼἽἾἿὈὉὊὋὌὍὐὒὔὖὙὛὝὟὨὩὪὫὬὭὮὯᾀᾁᾂᾃᾄᾅᾆᾇᾈᾈᾉᾉᾊᾊᾋᾋᾌᾌᾍᾍᾎᾎᾏᾏᾐᾑᾒᾓᾔᾕᾖᾗᾘᾘᾙᾙᾚᾚᾛᾛᾜᾜᾝᾝᾞᾞᾟᾟᾠᾡᾢᾣᾤᾥᾦᾧᾨᾨᾩᾩᾪᾪᾫᾫᾬᾬᾭᾭᾮᾮᾯᾯᾲᾳᾴᾶᾷᾸᾹᾺΆᾼᾼιῂῃῄῆῇῈΈῊΉῌῌῒΐῖῗῘῙῚΊῢΰῤῦῧῨῩῪΎῬῲῳῴῶῷῸΌῺΏῼῼΩKÅℲⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯↃⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏⰀⰁⰂⰃⰄⰅⰆⰇⰈⰉⰊⰋⰌⰍⰎⰏⰐⰑⰒⰓⰔⰕⰖⰗⰘⰙⰚⰛⰜⰝⰞⰟⰠⰡⰢⰣⰤⰥⰦⰧⰨⰩⰪⰫⰬⰭⰮⱠⱢⱣⱤⱧⱩⱫⱭⱮⱯⱰⱲⱵⱾⱿⲀⲂⲄⲆⲈⲊⲌⲎⲐⲒⲔⲖⲘⲚⲜⲞⲠⲢⲤⲦⲨⲪⲬⲮⲰⲲⲴⲶⲸⲺⲼⲾⳀⳂⳄⳆⳈⳊⳌⳎⳐⳒⳔⳖⳘⳚⳜⳞⳠⳢⳫⳭⳲ𐐀𐐁𐐂𐐃𐐄𐐅𐐆𐐇𐐈𐐉𐐊𐐋𐐌𐐍𐐎𐐏𐐐𐐑𐐒𐐓𐐔𐐕𐐖𐐗𐐘𐐙𐐚𐐛𐐜𐐝𐐞𐐟𐐠𐐡𐐢𐐣𐐤𐐥𐐦𐐧𐒰𐒱𐒲𐒳𐒴𐒵𐒶𐒷𐒸𐒹𐒺𐒻𐒼𐒽𐒾𐒿𐓀𐓁𐓂𐓃𐓄𐓅𐓆𐓇𐓈𐓉𐓊𐓋𐓌𐓍𐓎𐓏𐓐𐓑𐓒𐓓𐲀𐲁𐲂𐲃𐲄𐲅𐲆𐲇𐲈𐲉𐲊𐲋𐲌𐲍𐲎𐲏𐲐𐲑𐲒𐲓𐲔𐲕𐲖𐲗𐲘𐲙𐲚𐲛𐲜𐲝𐲞𐲟𐲠𐲡𐲢𐲣𐲤𐲥𐲦𐲧𐲨𐲩𐲪𐲫𐲬𐲭𐲮𐲯𐲰𐲱𐲲𑢠𑢡𑢢𑢣𑢤𑢥𑢦𑢧𑢨𑢩𑢪𑢫𑢬𑢭𑢮𑢯𑢰𑢱𑢲𑢳𑢴𑢵𑢶𑢷𑢸𑢹𑢺𑢻𑢼𑢽𑢾𑢿𖹀𖹁𖹂𖹃𖹄𖹅𖹆𖹇𖹈𖹉𖹊𖹋𖹌𖹍𖹎𖹏𖹐𖹑𖹒𖹓𖹔𖹕𖹖𖹗𖹘𖹙𖹚𖹛𖹜𖹝𖹞𖹟𞤀𞤁𞤂𞤃𞤄𞤅𞤆𞤇𞤈𞤉𞤊𞤋𞤌𞤍𞤎𞤏𞤐𞤑𞤒𞤓𞤔𞤕𞤖𞤗𞤘𞤙𞤚𞤛𞤜𞤝𞤞𞤟𞤠𞤡

Lowercase Characters

abcdefghiıjklmnopqrstuvwxyzμàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþssāăąćĉċčďđēĕėęěĝğġģĥħĩīĭįi̇iijĵķĺļľŀłńņňʼnŋōŏőœŕŗřśŝşšţťŧũūŭůűųŵŷÿźżžsɓƃƅɔƈɖɗƌǝəɛƒɠɣɩɨƙɯɲɵơƣƥʀƨʃƭʈưʊʋƴƶʒƹƽdždžljljnjnjǎǐǒǔǖǘǚǜǟǡǣǥǧǩǫǭǯǰdzdzǵƕƿǹǻǽǿȁȃȅȇȉȋȍȏȑȓȕȗșțȝȟƞȣȥȧȩȫȭȯȱȳⱥȼƚⱦɂƀʉʌɇɉɋɍɏιͱͳͷϳάέήίόύώΐαβγδεζηθικλμνξοπρστυφχψωϊϋΰσϗβθφπϙϛϝϟϡϣϥϧϩϫϭϯκρθεϸϲϻͻͼͽѐёђѓєѕіїјљњћќѝўџабвгдежзийклмнопрстуфхцчшщъыьэюяѡѣѥѧѩѫѭѯѱѳѵѷѹѻѽѿҁҋҍҏґғҕҗҙқҝҟҡңҥҧҩҫҭүұҳҵҷҹһҽҿӏӂӄӆӈӊӌӎӑӓӕӗәӛӝӟӡӣӥӧөӫӭӯӱӳӵӷӹӻӽӿԁԃԅԇԉԋԍԏԑԓԕԗԙԛԝԟԡԣԥԧԩԫԭԯաբգդեզէըթժիլխծկհձղճմյնշոչպջռսվտրցւփքօֆեւⴀⴁⴂⴃⴄⴅⴆⴇⴈⴉⴊⴋⴌⴍⴎⴏⴐⴑⴒⴓⴔⴕⴖⴗⴘⴙⴚⴛⴜⴝⴞⴟⴠⴡⴢⴣⴤⴥⴧⴭᏰᏱᏲᏳᏴᏵвдосттъѣꙋაბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶჷჸჹჺჽჾჿḁḃḅḇḉḋḍḏḑḓḕḗḙḛḝḟḡḣḥḧḩḫḭḯḱḳḵḷḹḻḽḿṁṃṅṇṉṋṍṏṑṓṕṗṙṛṝṟṡṣṥṧṩṫṭṯṱṳṵṷṹṻṽṿẁẃẅẇẉẋẍẏẑẓẕẖẗẘẙaʾṡssßạảấầẩẫậắằẳẵặẹẻẽếềểễệỉịọỏốồổỗộớờởỡợụủứừửữựỳỵỷỹỻỽỿἀἁἂἃἄἅἆἇἐἑἒἓἔἕἠἡἢἣἤἥἦἧἰἱἲἳἴἵἶἷὀὁὂὃὄὅὐὒὔὖὑὓὕὗὠὡὢὣὤὥὦὧἀιἁιἂιἃιἄιἅιἆιἇιἀιᾀἁιᾁἂιᾂἃιᾃἄιᾄἅιᾅἆιᾆἇιᾇἠιἡιἢιἣιἤιἥιἦιἧιἠιᾐἡιᾑἢιᾒἣιᾓἤιᾔἥιᾕἦιᾖἧιᾗὠιὡιὢιὣιὤιὥιὦιὧιὠιᾠὡιᾡὢιᾢὣιᾣὤιᾤὥιᾥὦιᾦὧιᾧὰιαιάιᾶᾶιᾰᾱὰάαιᾳιὴιηιήιῆῆιὲέὴήηιῃῒΐῖῗῐῑὶίῢΰῤῦῧῠῡὺύῥὼιωιώιῶῶιὸόὼώωιῳωkåⅎⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻⅼⅽⅾⅿↄⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩⰰⰱⰲⰳⰴⰵⰶⰷⰸⰹⰺⰻⰼⰽⰾⰿⱀⱁⱂⱃⱄⱅⱆⱇⱈⱉⱊⱋⱌⱍⱎⱏⱐⱑⱒⱓⱔⱕⱖⱗⱘⱙⱚⱛⱜⱝⱞⱡɫᵽɽⱨⱪⱬɑɱɐɒⱳⱶȿɀⲁⲃⲅⲇⲉⲋⲍⲏⲑⲓⲕⲗⲙⲛⲝⲟⲡⲣⲥⲧⲩⲫⲭⲯⲱⲳⲵⲷⲹⲻⲽⲿⳁⳃⳅⳇⳉⳋⳍⳏⳑⳓⳕⳗⳙⳛⳝⳟⳡⳣⳬⳮⳳ𐐨𐐩𐐪𐐫𐐬𐐭𐐮𐐯𐐰𐐱𐐲𐐳𐐴𐐵𐐶𐐷𐐸𐐹𐐺𐐻𐐼𐐽𐐾𐐿𐑀𐑁𐑂𐑃𐑄𐑅𐑆𐑇𐑈𐑉𐑊𐑋𐑌𐑍𐑎𐑏𐓘𐓙𐓚𐓛𐓜𐓝𐓞𐓟𐓠𐓡𐓢𐓣𐓤𐓥𐓦𐓧𐓨𐓩𐓪𐓫𐓬𐓭𐓮𐓯𐓰𐓱𐓲𐓳𐓴𐓵𐓶𐓷𐓸𐓹𐓺𐓻𐳀𐳁𐳂𐳃𐳄𐳅𐳆𐳇𐳈𐳉𐳊𐳋𐳌𐳍𐳎𐳏𐳐𐳑𐳒𐳓𐳔𐳕𐳖𐳗𐳘𐳙𐳚𐳛𐳜𐳝𐳞𐳟𐳠𐳡𐳢𐳣𐳤𐳥𐳦𐳧𐳨𐳩𐳪𐳫𐳬𐳭𐳮𐳯𐳰𐳱𐳲𑣀𑣁𑣂𑣃𑣄𑣅𑣆𑣇𑣈𑣉𑣊𑣋𑣌𑣍𑣎𑣏𑣐𑣑𑣒𑣓𑣔𑣕𑣖𑣗𑣘𑣙𑣚𑣛𑣜𑣝𑣞𑣟𖹠𖹡𖹢𖹣𖹤𖹥𖹦𖹧𖹨𖹩𖹪𖹫𖹬𖹭𖹮𖹯𖹰𖹱𖹲𖹳𖹴𖹵𖹶𖹷𖹸𖹹𖹺𖹻𖹼𖹽𖹾𖹿𞤢𞤣𞤤𞤥𞤦𞤧𞤨𞤩𞤪𞤫𞤬𞤭𞤮𞤯𞤰𞤱𞤲𞤳𞤴𞤵𞤶𞤷𞤸𞤹𞤺𞤻𞤼𞤽𞤾𞤿𞥀𞥁𞥂𞥃

Uppercase Codepoints

0041, 0042, 0043, 0044, 0045, 0046, 0047, 0048, 0049, 0049, 004A, 004B, 004C, 004D, 004E, 004F, 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, 0058, 0059, 005A, 00B5, 00C0, 00C1, 00C2, 00C3, 00C4, 00C5, 00C6, 00C7, 00C8, 00C9, 00CA, 00CB, 00CC, 00CD, 00CE, 00CF, 00D0, 00D1, 00D2, 00D3, 00D4, 00D5, 00D6, 00D8, 00D9, 00DA, 00DB, 00DC, 00DD, 00DE, 00DF, 0100, 0102, 0104, 0106, 0108, 010A, 010C, 010E, 0110, 0112, 0114, 0116, 0118, 011A, 011C, 011E, 0120, 0122, 0124, 0126, 0128, 012A, 012C, 012E, 0130, 0130, 0132, 0134, 0136, 0139, 013B, 013D, 013F, 0141, 0143, 0145, 0147, 0149, 014A, 014C, 014E, 0150, 0152, 0154, 0156, 0158, 015A, 015C, 015E, 0160, 0162, 0164, 0166, 0168, 016A, 016C, 016E, 0170, 0172, 0174, 0176, 0178, 0179, 017B, 017D, 017F, 0181, 0182, 0184, 0186, 0187, 0189, 018A, 018B, 018E, 018F, 0190, 0191, 0193, 0194, 0196, 0197, 0198, 019C, 019D, 019F, 01A0, 01A2, 01A4, 01A6, 01A7, 01A9, 01AC, 01AE, 01AF, 01B1, 01B2, 01B3, 01B5, 01B7, 01B8, 01BC, 01C4, 01C5, 01C7, 01C8, 01CA, 01CB, 01CD, 01CF, 01D1, 01D3, 01D5, 01D7, 01D9, 01DB, 01DE, 01E0, 01E2, 01E4, 01E6, 01E8, 01EA, 01EC, 01EE, 01F0, 01F1, 01F2, 01F4, 01F6, 01F7, 01F8, 01FA, 01FC, 01FE, 0200, 0202, 0204, 0206, 0208, 020A, 020C, 020E, 0210, 0212, 0214, 0216, 0218, 021A, 021C, 021E, 0220, 0222, 0224, 0226, 0228, 022A, 022C, 022E, 0230, 0232, 023A, 023B, 023D, 023E, 0241, 0243, 0244, 0245, 0246, 0248, 024A, 024C, 024E, 0345, 0370, 0372, 0376, 037F, 0386, 0388, 0389, 038A, 038C, 038E, 038F, 0390, 0391, 0392, 0393, 0394, 0395, 0396, 0397, 0398, 0399, 039A, 039B, 039C, 039D, 039E, 039F, 03A0, 03A1, 03A3, 03A4, 03A5, 03A6, 03A7, 03A8, 03A9, 03AA, 03AB, 03B0, 03C2, 03CF, 03D0, 03D1, 03D5, 03D6, 03D8, 03DA, 03DC, 03DE, 03E0, 03E2, 03E4, 03E6, 03E8, 03EA, 03EC, 03EE, 03F0, 03F1, 03F4, 03F5, 03F7, 03F9, 03FA, 03FD, 03FE, 03FF, 0400, 0401, 0402, 0403, 0404, 0405, 0406, 0407, 0408, 0409, 040A, 040B, 040C, 040D, 040E, 040F, 0410, 0411, 0412, 0413, 0414, 0415, 0416, 0417, 0418, 0419, 041A, 041B, 041C, 041D, 041E, 041F, 0420, 0421, 0422, 0423, 0424, 0425, 0426, 0427, 0428, 0429, 042A, 042B, 042C, 042D, 042E, 042F, 0460, 0462, 0464, 0466, 0468, 046A, 046C, 046E, 0470, 0472, 0474, 0476, 0478, 047A, 047C, 047E, 0480, 048A, 048C, 048E, 0490, 0492, 0494, 0496, 0498, 049A, 049C, 049E, 04A0, 04A2, 04A4, 04A6, 04A8, 04AA, 04AC, 04AE, 04B0, 04B2, 04B4, 04B6, 04B8, 04BA, 04BC, 04BE, 04C0, 04C1, 04C3, 04C5, 04C7, 04C9, 04CB, 04CD, 04D0, 04D2, 04D4, 04D6, 04D8, 04DA, 04DC, 04DE, 04E0, 04E2, 04E4, 04E6, 04E8, 04EA, 04EC, 04EE, 04F0, 04F2, 04F4, 04F6, 04F8, 04FA, 04FC, 04FE, 0500, 0502, 0504, 0506, 0508, 050A, 050C, 050E, 0510, 0512, 0514, 0516, 0518, 051A, 051C, 051E, 0520, 0522, 0524, 0526, 0528, 052A, 052C, 052E, 0531, 0532, 0533, 0534, 0535, 0536, 0537, 0538, 0539, 053A, 053B, 053C, 053D, 053E, 053F, 0540, 0541, 0542, 0543, 0544, 0545, 0546, 0547, 0548, 0549, 054A, 054B, 054C, 054D, 054E, 054F, 0550, 0551, 0552, 0553, 0554, 0555, 0556, 0587, 10A0, 10A1, 10A2, 10A3, 10A4, 10A5, 10A6, 10A7, 10A8, 10A9, 10AA, 10AB, 10AC, 10AD, 10AE, 10AF, 10B0, 10B1, 10B2, 10B3, 10B4, 10B5, 10B6, 10B7, 10B8, 10B9, 10BA, 10BB, 10BC, 10BD, 10BE, 10BF, 10C0, 10C1, 10C2, 10C3, 10C4, 10C5, 10C7, 10CD, 13F8, 13F9, 13FA, 13FB, 13FC, 13FD, 1C80, 1C81, 1C82, 1C83, 1C84, 1C85, 1C86, 1C87, 1C88, 1C90, 1C91, 1C92, 1C93, 1C94, 1C95, 1C96, 1C97, 1C98, 1C99, 1C9A, 1C9B, 1C9C, 1C9D, 1C9E, 1C9F, 1CA0, 1CA1, 1CA2, 1CA3, 1CA4, 1CA5, 1CA6, 1CA7, 1CA8, 1CA9, 1CAA, 1CAB, 1CAC, 1CAD, 1CAE, 1CAF, 1CB0, 1CB1, 1CB2, 1CB3, 1CB4, 1CB5, 1CB6, 1CB7, 1CB8, 1CB9, 1CBA, 1CBD, 1CBE, 1CBF, 1E00, 1E02, 1E04, 1E06, 1E08, 1E0A, 1E0C, 1E0E, 1E10, 1E12, 1E14, 1E16, 1E18, 1E1A, 1E1C, 1E1E, 1E20, 1E22, 1E24, 1E26, 1E28, 1E2A, 1E2C, 1E2E, 1E30, 1E32, 1E34, 1E36, 1E38, 1E3A, 1E3C, 1E3E, 1E40, 1E42, 1E44, 1E46, 1E48, 1E4A, 1E4C, 1E4E, 1E50, 1E52, 1E54, 1E56, 1E58, 1E5A, 1E5C, 1E5E, 1E60, 1E62, 1E64, 1E66, 1E68, 1E6A, 1E6C, 1E6E, 1E70, 1E72, 1E74, 1E76, 1E78, 1E7A, 1E7C, 1E7E, 1E80, 1E82, 1E84, 1E86, 1E88, 1E8A, 1E8C, 1E8E, 1E90, 1E92, 1E94, 1E96, 1E97, 1E98, 1E99, 1E9A, 1E9B, 1E9E, 1E9E, 1EA0, 1EA2, 1EA4, 1EA6, 1EA8, 1EAA, 1EAC, 1EAE, 1EB0, 1EB2, 1EB4, 1EB6, 1EB8, 1EBA, 1EBC, 1EBE, 1EC0, 1EC2, 1EC4, 1EC6, 1EC8, 1ECA, 1ECC, 1ECE, 1ED0, 1ED2, 1ED4, 1ED6, 1ED8, 1EDA, 1EDC, 1EDE, 1EE0, 1EE2, 1EE4, 1EE6, 1EE8, 1EEA, 1EEC, 1EEE, 1EF0, 1EF2, 1EF4, 1EF6, 1EF8, 1EFA, 1EFC, 1EFE, 1F08, 1F09, 1F0A, 1F0B, 1F0C, 1F0D, 1F0E, 1F0F, 1F18, 1F19, 1F1A, 1F1B, 1F1C, 1F1D, 1F28, 1F29, 1F2A, 1F2B, 1F2C, 1F2D, 1F2E, 1F2F, 1F38, 1F39, 1F3A, 1F3B, 1F3C, 1F3D, 1F3E, 1F3F, 1F48, 1F49, 1F4A, 1F4B, 1F4C, 1F4D, 1F50, 1F52, 1F54, 1F56, 1F59, 1F5B, 1F5D, 1F5F, 1F68, 1F69, 1F6A, 1F6B, 1F6C, 1F6D, 1F6E, 1F6F, 1F80, 1F81, 1F82, 1F83, 1F84, 1F85, 1F86, 1F87, 1F88, 1F88, 1F89, 1F89, 1F8A, 1F8A, 1F8B, 1F8B, 1F8C, 1F8C, 1F8D, 1F8D, 1F8E, 1F8E, 1F8F, 1F8F, 1F90, 1F91, 1F92, 1F93, 1F94, 1F95, 1F96, 1F97, 1F98, 1F98, 1F99, 1F99, 1F9A, 1F9A, 1F9B, 1F9B, 1F9C, 1F9C, 1F9D, 1F9D, 1F9E, 1F9E, 1F9F, 1F9F, 1FA0, 1FA1, 1FA2, 1FA3, 1FA4, 1FA5, 1FA6, 1FA7, 1FA8, 1FA8, 1FA9, 1FA9, 1FAA, 1FAA, 1FAB, 1FAB, 1FAC, 1FAC, 1FAD, 1FAD, 1FAE, 1FAE, 1FAF, 1FAF, 1FB2, 1FB3, 1FB4, 1FB6, 1FB7, 1FB8, 1FB9, 1FBA, 1FBB, 1FBC, 1FBC, 1FBE, 1FC2, 1FC3, 1FC4, 1FC6, 1FC7, 1FC8, 1FC9, 1FCA, 1FCB, 1FCC, 1FCC, 1FD2, 1FD3, 1FD6, 1FD7, 1FD8, 1FD9, 1FDA, 1FDB, 1FE2, 1FE3, 1FE4, 1FE6, 1FE7, 1FE8, 1FE9, 1FEA, 1FEB, 1FEC, 1FF2, 1FF3, 1FF4, 1FF6, 1FF7, 1FF8, 1FF9, 1FFA, 1FFB, 1FFC, 1FFC, 2126, 212A, 212B, 2132, 2160, 2161, 2162, 2163, 2164, 2165, 2166, 2167, 2168, 2169, 216A, 216B, 216C, 216D, 216E, 216F, 2183, 24B6, 24B7, 24B8, 24B9, 24BA, 24BB, 24BC, 24BD, 24BE, 24BF, 24C0, 24C1, 24C2, 24C3, 24C4, 24C5, 24C6, 24C7, 24C8, 24C9, 24CA, 24CB, 24CC, 24CD, 24CE, 24CF, 2C00, 2C01, 2C02, 2C03, 2C04, 2C05, 2C06, 2C07, 2C08, 2C09, 2C0A, 2C0B, 2C0C, 2C0D, 2C0E, 2C0F, 2C10, 2C11, 2C12, 2C13, 2C14, 2C15, 2C16, 2C17, 2C18, 2C19, 2C1A, 2C1B, 2C1C, 2C1D, 2C1E, 2C1F, 2C20, 2C21, 2C22, 2C23, 2C24, 2C25, 2C26, 2C27, 2C28, 2C29, 2C2A, 2C2B, 2C2C, 2C2D, 2C2E, 2C60, 2C62, 2C63, 2C64, 2C67, 2C69, 2C6B, 2C6D, 2C6E, 2C6F, 2C70, 2C72, 2C75, 2C7E, 2C7F, 2C80, 2C82, 2C84, 2C86, 2C88, 2C8A, 2C8C, 2C8E, 2C90, 2C92, 2C94, 2C96, 2C98, 2C9A, 2C9C, 2C9E, 2CA0, 2CA2, 2CA4, 2CA6, 2CA8, 2CAA, 2CAC, 2CAE, 2CB0, 2CB2, 2CB4, 2CB6, 2CB8, 2CBA, 2CBC, 2CBE, 2CC0, 2CC2, 2CC4, 2CC6, 2CC8, 2CCA, 2CCC, 2CCE, 2CD0, 2CD2, 2CD4, 2CD6, 2CD8, 2CDA, 2CDC, 2CDE, 2CE0, 2CE2, 2CEB, 2CED, 2CF2, 10400, 10401, 10402, 10403, 10404, 10405, 10406, 10407, 10408, 10409, 1040A, 1040B, 1040C, 1040D, 1040E, 1040F, 10410, 10411, 10412, 10413, 10414, 10415, 10416, 10417, 10418, 10419, 1041A, 1041B, 1041C, 1041D, 1041E, 1041F, 10420, 10421, 10422, 10423, 10424, 10425, 10426, 10427, 104B0, 104B1, 104B2, 104B3, 104B4, 104B5, 104B6, 104B7, 104B8, 104B9, 104BA, 104BB, 104BC, 104BD, 104BE, 104BF, 104C0, 104C1, 104C2, 104C3, 104C4, 104C5, 104C6, 104C7, 104C8, 104C9, 104CA, 104CB, 104CC, 104CD, 104CE, 104CF, 104D0, 104D1, 104D2, 104D3, 10C80, 10C81, 10C82, 10C83, 10C84, 10C85, 10C86, 10C87, 10C88, 10C89, 10C8A, 10C8B, 10C8C, 10C8D, 10C8E, 10C8F, 10C90, 10C91, 10C92, 10C93, 10C94, 10C95, 10C96, 10C97, 10C98, 10C99, 10C9A, 10C9B, 10C9C, 10C9D, 10C9E, 10C9F, 10CA0, 10CA1, 10CA2, 10CA3, 10CA4, 10CA5, 10CA6, 10CA7, 10CA8, 10CA9, 10CAA, 10CAB, 10CAC, 10CAD, 10CAE, 10CAF, 10CB0, 10CB1, 10CB2, 118A0, 118A1, 118A2, 118A3, 118A4, 118A5, 118A6, 118A7, 118A8, 118A9, 118AA, 118AB, 118AC, 118AD, 118AE, 118AF, 118B0, 118B1, 118B2, 118B3, 118B4, 118B5, 118B6, 118B7, 118B8, 118B9, 118BA, 118BB, 118BC, 118BD, 118BE, 118BF, 16E40, 16E41, 16E42, 16E43, 16E44, 16E45, 16E46, 16E47, 16E48, 16E49, 16E4A, 16E4B, 16E4C, 16E4D, 16E4E, 16E4F, 16E50, 16E51, 16E52, 16E53, 16E54, 16E55, 16E56, 16E57, 16E58, 16E59, 16E5A, 16E5B, 16E5C, 16E5D, 16E5E, 16E5F, 1E900, 1E901, 1E902, 1E903, 1E904, 1E905, 1E906, 1E907, 1E908, 1E909, 1E90A, 1E90B, 1E90C, 1E90D, 1E90E, 1E90F, 1E910, 1E911, 1E912, 1E913, 1E914, 1E915, 1E916, 1E917, 1E918, 1E919, 1E91A, 1E91B, 1E91C, 1E91D, 1E91E, 1E91F, 1E920, 1E921

Lowercase Codepoints

0061, 0062, 0063, 0064, 0065, 0066, 0067, 0068, 0069, 0131, 006A, 006B, 006C, 006D, 006E, 006F, 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, 0078, 0079, 007A, 03BC, 00E0, 00E1, 00E2, 00E3, 00E4, 00E5, 00E6, 00E7, 00E8, 00E9, 00EA, 00EB, 00EC, 00ED, 00EE, 00EF, 00F0, 00F1, 00F2, 00F3, 00F4, 00F5, 00F6, 00F8, 00F9, 00FA, 00FB, 00FC, 00FD, 00FE, 0073 0073, 0101, 0103, 0105, 0107, 0109, 010B, 010D, 010F, 0111, 0113, 0115, 0117, 0119, 011B, 011D, 011F, 0121, 0123, 0125, 0127, 0129, 012B, 012D, 012F, 0069 0307, 0069, 0133, 0135, 0137, 013A, 013C, 013E, 0140, 0142, 0144, 0146, 0148, 02BC 006E, 014B, 014D, 014F, 0151, 0153, 0155, 0157, 0159, 015B, 015D, 015F, 0161, 0163, 0165, 0167, 0169, 016B, 016D, 016F, 0171, 0173, 0175, 0177, 00FF, 017A, 017C, 017E, 0073, 0253, 0183, 0185, 0254, 0188, 0256, 0257, 018C, 01DD, 0259, 025B, 0192, 0260, 0263, 0269, 0268, 0199, 026F, 0272, 0275, 01A1, 01A3, 01A5, 0280, 01A8, 0283, 01AD, 0288, 01B0, 028A, 028B, 01B4, 01B6, 0292, 01B9, 01BD, 01C6, 01C6, 01C9, 01C9, 01CC, 01CC, 01CE, 01D0, 01D2, 01D4, 01D6, 01D8, 01DA, 01DC, 01DF, 01E1, 01E3, 01E5, 01E7, 01E9, 01EB, 01ED, 01EF, 006A 030C, 01F3, 01F3, 01F5, 0195, 01BF, 01F9, 01FB, 01FD, 01FF, 0201, 0203, 0205, 0207, 0209, 020B, 020D, 020F, 0211, 0213, 0215, 0217, 0219, 021B, 021D, 021F, 019E, 0223, 0225, 0227, 0229, 022B, 022D, 022F, 0231, 0233, 2C65, 023C, 019A, 2C66, 0242, 0180, 0289, 028C, 0247, 0249, 024B, 024D, 024F, 03B9, 0371, 0373, 0377, 03F3, 03AC, 03AD, 03AE, 03AF, 03CC, 03CD, 03CE, 03B9 0308 0301, 03B1, 03B2, 03B3, 03B4, 03B5, 03B6, 03B7, 03B8, 03B9, 03BA, 03BB, 03BC, 03BD, 03BE, 03BF, 03C0, 03C1, 03C3, 03C4, 03C5, 03C6, 03C7, 03C8, 03C9, 03CA, 03CB, 03C5 0308 0301, 03C3, 03D7, 03B2, 03B8, 03C6, 03C0, 03D9, 03DB, 03DD, 03DF, 03E1, 03E3, 03E5, 03E7, 03E9, 03EB, 03ED, 03EF, 03BA, 03C1, 03B8, 03B5, 03F8, 03F2, 03FB, 037B, 037C, 037D, 0450, 0451, 0452, 0453, 0454, 0455, 0456, 0457, 0458, 0459, 045A, 045B, 045C, 045D, 045E, 045F, 0430, 0431, 0432, 0433, 0434, 0435, 0436, 0437, 0438, 0439, 043A, 043B, 043C, 043D, 043E, 043F, 0440, 0441, 0442, 0443, 0444, 0445, 0446, 0447, 0448, 0449, 044A, 044B, 044C, 044D, 044E, 044F, 0461, 0463, 0465, 0467, 0469, 046B, 046D, 046F, 0471, 0473, 0475, 0477, 0479, 047B, 047D, 047F, 0481, 048B, 048D, 048F, 0491, 0493, 0495, 0497, 0499, 049B, 049D, 049F, 04A1, 04A3, 04A5, 04A7, 04A9, 04AB, 04AD, 04AF, 04B1, 04B3, 04B5, 04B7, 04B9, 04BB, 04BD, 04BF, 04CF, 04C2, 04C4, 04C6, 04C8, 04CA, 04CC, 04CE, 04D1, 04D3, 04D5, 04D7, 04D9, 04DB, 04DD, 04DF, 04E1, 04E3, 04E5, 04E7, 04E9, 04EB, 04ED, 04EF, 04F1, 04F3, 04F5, 04F7, 04F9, 04FB, 04FD, 04FF, 0501, 0503, 0505, 0507, 0509, 050B, 050D, 050F, 0511, 0513, 0515, 0517, 0519, 051B, 051D, 051F, 0521, 0523, 0525, 0527, 0529, 052B, 052D, 052F, 0561, 0562, 0563, 0564, 0565, 0566, 0567, 0568, 0569, 056A, 056B, 056C, 056D, 056E, 056F, 0570, 0571, 0572, 0573, 0574, 0575, 0576, 0577, 0578, 0579, 057A, 057B, 057C, 057D, 057E, 057F, 0580, 0581, 0582, 0583, 0584, 0585, 0586, 0565 0582, 2D00, 2D01, 2D02, 2D03, 2D04, 2D05, 2D06, 2D07, 2D08, 2D09, 2D0A, 2D0B, 2D0C, 2D0D, 2D0E, 2D0F, 2D10, 2D11, 2D12, 2D13, 2D14, 2D15, 2D16, 2D17, 2D18, 2D19, 2D1A, 2D1B, 2D1C, 2D1D, 2D1E, 2D1F, 2D20, 2D21, 2D22, 2D23, 2D24, 2D25, 2D27, 2D2D, 13F0, 13F1, 13F2, 13F3, 13F4, 13F5, 0432, 0434, 043E, 0441, 0442, 0442, 044A, 0463, A64B, 10D0, 10D1, 10D2, 10D3, 10D4, 10D5, 10D6, 10D7, 10D8, 10D9, 10DA, 10DB, 10DC, 10DD, 10DE, 10DF, 10E0, 10E1, 10E2, 10E3, 10E4, 10E5, 10E6, 10E7, 10E8, 10E9, 10EA, 10EB, 10EC, 10ED, 10EE, 10EF, 10F0, 10F1, 10F2, 10F3, 10F4, 10F5, 10F6, 10F7, 10F8, 10F9, 10FA, 10FD, 10FE, 10FF, 1E01, 1E03, 1E05, 1E07, 1E09, 1E0B, 1E0D, 1E0F, 1E11, 1E13, 1E15, 1E17, 1E19, 1E1B, 1E1D, 1E1F, 1E21, 1E23, 1E25, 1E27, 1E29, 1E2B, 1E2D, 1E2F, 1E31, 1E33, 1E35, 1E37, 1E39, 1E3B, 1E3D, 1E3F, 1E41, 1E43, 1E45, 1E47, 1E49, 1E4B, 1E4D, 1E4F, 1E51, 1E53, 1E55, 1E57, 1E59, 1E5B, 1E5D, 1E5F, 1E61, 1E63, 1E65, 1E67, 1E69, 1E6B, 1E6D, 1E6F, 1E71, 1E73, 1E75, 1E77, 1E79, 1E7B, 1E7D, 1E7F, 1E81, 1E83, 1E85, 1E87, 1E89, 1E8B, 1E8D, 1E8F, 1E91, 1E93, 1E95, 0068 0331, 0074 0308, 0077 030A, 0079 030A, 0061 02BE, 1E61, 0073 0073, 00DF, 1EA1, 1EA3, 1EA5, 1EA7, 1EA9, 1EAB, 1EAD, 1EAF, 1EB1, 1EB3, 1EB5, 1EB7, 1EB9, 1EBB, 1EBD, 1EBF, 1EC1, 1EC3, 1EC5, 1EC7, 1EC9, 1ECB, 1ECD, 1ECF, 1ED1, 1ED3, 1ED5, 1ED7, 1ED9, 1EDB, 1EDD, 1EDF, 1EE1, 1EE3, 1EE5, 1EE7, 1EE9, 1EEB, 1EED, 1EEF, 1EF1, 1EF3, 1EF5, 1EF7, 1EF9, 1EFB, 1EFD, 1EFF, 1F00, 1F01, 1F02, 1F03, 1F04, 1F05, 1F06, 1F07, 1F10, 1F11, 1F12, 1F13, 1F14, 1F15, 1F20, 1F21, 1F22, 1F23, 1F24, 1F25, 1F26, 1F27, 1F30, 1F31, 1F32, 1F33, 1F34, 1F35, 1F36, 1F37, 1F40, 1F41, 1F42, 1F43, 1F44, 1F45, 03C5 0313, 03C5 0313 0300, 03C5 0313 0301, 03C5 0313 0342, 1F51, 1F53, 1F55, 1F57, 1F60, 1F61, 1F62, 1F63, 1F64, 1F65, 1F66, 1F67, 1F00 03B9, 1F01 03B9, 1F02 03B9, 1F03 03B9, 1F04 03B9, 1F05 03B9, 1F06 03B9, 1F07 03B9, 1F00 03B9, 1F80, 1F01 03B9, 1F81, 1F02 03B9, 1F82, 1F03 03B9, 1F83, 1F04 03B9, 1F84, 1F05 03B9, 1F85, 1F06 03B9, 1F86, 1F07 03B9, 1F87, 1F20 03B9, 1F21 03B9, 1F22 03B9, 1F23 03B9, 1F24 03B9, 1F25 03B9, 1F26 03B9, 1F27 03B9, 1F20 03B9, 1F90, 1F21 03B9, 1F91, 1F22 03B9, 1F92, 1F23 03B9, 1F93, 1F24 03B9, 1F94, 1F25 03B9, 1F95, 1F26 03B9, 1F96, 1F27 03B9, 1F97, 1F60 03B9, 1F61 03B9, 1F62 03B9, 1F63 03B9, 1F64 03B9, 1F65 03B9, 1F66 03B9, 1F67 03B9, 1F60 03B9, 1FA0, 1F61 03B9, 1FA1, 1F62 03B9, 1FA2, 1F63 03B9, 1FA3, 1F64 03B9, 1FA4, 1F65 03B9, 1FA5, 1F66 03B9, 1FA6, 1F67 03B9, 1FA7, 1F70 03B9, 03B1 03B9, 03AC 03B9, 03B1 0342, 03B1 0342 03B9, 1FB0, 1FB1, 1F70, 1F71, 03B1 03B9, 1FB3, 03B9, 1F74 03B9, 03B7 03B9, 03AE 03B9, 03B7 0342, 03B7 0342 03B9, 1F72, 1F73, 1F74, 1F75, 03B7 03B9, 1FC3, 03B9 0308 0300, 03B9 0308 0301, 03B9 0342, 03B9 0308 0342, 1FD0, 1FD1, 1F76, 1F77, 03C5 0308 0300, 03C5 0308 0301, 03C1 0313, 03C5 0342, 03C5 0308 0342, 1FE0, 1FE1, 1F7A, 1F7B, 1FE5, 1F7C 03B9, 03C9 03B9, 03CE 03B9, 03C9 0342, 03C9 0342 03B9, 1F78, 1F79, 1F7C, 1F7D, 03C9 03B9, 1FF3, 03C9, 006B, 00E5, 214E, 2170, 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 217A, 217B, 217C, 217D, 217E, 217F, 2184, 24D0, 24D1, 24D2, 24D3, 24D4, 24D5, 24D6, 24D7, 24D8, 24D9, 24DA, 24DB, 24DC, 24DD, 24DE, 24DF, 24E0, 24E1, 24E2, 24E3, 24E4, 24E5, 24E6, 24E7, 24E8, 24E9, 2C30, 2C31, 2C32, 2C33, 2C34, 2C35, 2C36, 2C37, 2C38, 2C39, 2C3A, 2C3B, 2C3C, 2C3D, 2C3E, 2C3F, 2C40, 2C41, 2C42, 2C43, 2C44, 2C45, 2C46, 2C47, 2C48, 2C49, 2C4A, 2C4B, 2C4C, 2C4D, 2C4E, 2C4F, 2C50, 2C51, 2C52, 2C53, 2C54, 2C55, 2C56, 2C57, 2C58, 2C59, 2C5A, 2C5B, 2C5C, 2C5D, 2C5E, 2C61, 026B, 1D7D, 027D, 2C68, 2C6A, 2C6C, 0251, 0271, 0250, 0252, 2C73, 2C76, 023F, 0240, 2C81, 2C83, 2C85, 2C87, 2C89, 2C8B, 2C8D, 2C8F, 2C91, 2C93, 2C95, 2C97, 2C99, 2C9B, 2C9D, 2C9F, 2CA1, 2CA3, 2CA5, 2CA7, 2CA9, 2CAB, 2CAD, 2CAF, 2CB1, 2CB3, 2CB5, 2CB7, 2CB9, 2CBB, 2CBD, 2CBF, 2CC1, 2CC3, 2CC5, 2CC7, 2CC9, 2CCB, 2CCD, 2CCF, 2CD1, 2CD3, 2CD5, 2CD7, 2CD9, 2CDB, 2CDD, 2CDF, 2CE1, 2CE3, 2CEC, 2CEE, 2CF3, 10428, 10429, 1042A, 1042B, 1042C, 1042D, 1042E, 1042F, 10430, 10431, 10432, 10433, 10434, 10435, 10436, 10437, 10438, 10439, 1043A, 1043B, 1043C, 1043D, 1043E, 1043F, 10440, 10441, 10442, 10443, 10444, 10445, 10446, 10447, 10448, 10449, 1044A, 1044B, 1044C, 1044D, 1044E, 1044F, 104D8, 104D9, 104DA, 104DB, 104DC, 104DD, 104DE, 104DF, 104E0, 104E1, 104E2, 104E3, 104E4, 104E5, 104E6, 104E7, 104E8, 104E9, 104EA, 104EB, 104EC, 104ED, 104EE, 104EF, 104F0, 104F1, 104F2, 104F3, 104F4, 104F5, 104F6, 104F7, 104F8, 104F9, 104FA, 104FB, 10CC0, 10CC1, 10CC2, 10CC3, 10CC4, 10CC5, 10CC6, 10CC7, 10CC8, 10CC9, 10CCA, 10CCB, 10CCC, 10CCD, 10CCE, 10CCF, 10CD0, 10CD1, 10CD2, 10CD3, 10CD4, 10CD5, 10CD6, 10CD7, 10CD8, 10CD9, 10CDA, 10CDB, 10CDC, 10CDD, 10CDE, 10CDF, 10CE0, 10CE1, 10CE2, 10CE3, 10CE4, 10CE5, 10CE6, 10CE7, 10CE8, 10CE9, 10CEA, 10CEB, 10CEC, 10CED, 10CEE, 10CEF, 10CF0, 10CF1, 10CF2, 118C0, 118C1, 118C2, 118C3, 118C4, 118C5, 118C6, 118C7, 118C8, 118C9, 118CA, 118CB, 118CC, 118CD, 118CE, 118CF, 118D0, 118D1, 118D2, 118D3, 118D4, 118D5, 118D6, 118D7, 118D8, 118D9, 118DA, 118DB, 118DC, 118DD, 118DE, 118DF, 16E60, 16E61, 16E62, 16E63, 16E64, 16E65, 16E66, 16E67, 16E68, 16E69, 16E6A, 16E6B, 16E6C, 16E6D, 16E6E, 16E6F, 16E70, 16E71, 16E72, 16E73, 16E74, 16E75, 16E76, 16E77, 16E78, 16E79, 16E7A, 16E7B, 16E7C, 16E7D, 16E7E, 16E7F, 1E922, 1E923, 1E924, 1E925, 1E926, 1E927, 1E928, 1E929, 1E92A, 1E92B, 1E92C, 1E92D, 1E92E, 1E92F, 1E930, 1E931, 1E932, 1E933, 1E934, 1E935, 1E936, 1E937, 1E938, 1E939, 1E93A, 1E93B, 1E93C, 1E93D, 1E93E, 1E93F, 1E940, 1E941, 1E942, 1E943
\$\endgroup\$
  • 1
    \$\begingroup\$ @darrylyeo I think you need to make it a little more clear that there are three cases. \$\endgroup\$ – Adám Jun 4 at 20:59
  • 18
    \$\begingroup\$ Google traslate thought that this question is in Vietnamese. \$\endgroup\$ – user92069 Jun 4 at 23:16
  • 1
    \$\begingroup\$ Really interesting challenge. It basically boils down to: 1) write a program with no uppercase letters that lowercases; 2) write a program with no lowercase letters that uppercases; 3) combine those two. I'm not sure if 1 and 2 are possible in JavaScript. I can write a function write iterates over a string and does something depending on the case of each letter, but I can't yet think of how to actually convert a 'c' into a 'C' without using a function like toUpperCase() etc. \$\endgroup\$ – Steve Bennett Jun 4 at 23:32
  • 1
    \$\begingroup\$ It may be a good idea to allow functions as well, since a lot of languages are unable to print or read input without using letters (also there are already a few answers which use functions instead of programs). \$\endgroup\$ – dingledooper Jun 4 at 23:58
  • 3
    \$\begingroup\$ IMO, When someone try to design a programming language, using any features based on lower / upper case letters is a bad idea. \$\endgroup\$ – tsh Jun 5 at 3:31

17 Answers 17

17
\$\begingroup\$

perl -p, 37 bytes

goto Aa_;A_:$_="\U$_";a_:$_=lc$_;Aa_:

Try it online!

Removing all lowercase letters leaves:

 A_;A_:$_="\U$_";_:$_=$_;A_:

Try it online!

Removing the upper case letters leaves:

goto a_;_:$_="\$_";a_:$_=lc$_;a_:

Try it online!

How it works? With nothing removed, control jumps to the end, leaving the input unmodified.

With the lowercase letters removed, we have the string A_ in void context (nothing happens), and then at label A_, we upper case the string, at label _, we have a no-op (assigning $_ to itself), and an empty statement at label A_. Finally, the result is printed.

With the upper case letters removed, we jump to label a_, which lower cases the string, and the result is printed.

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

Perl 5 + -p, 20 bytes

$_=0xE0?$_:lc"\lU$_"

Try it online!

With all uppercase removed.

With all lowercase removed.

Explanation

Because we're using the -p flag, the input is placed in$_ implicitly and $_ is printed implicitly when the program terminates.

In the unmodified program, this checks 0xE0, which is 224, for truthiness and sets $_ to itself.

When all uppercase characters are removed 0xE0 becomes 0x0 which is 0 and the else block is reached which sets $_ to lc"\l$_". lc is Perl's lowercase function and converts the string to lowercase. \l is a string modifier that changes the immediately following character to lowercase, but this is irrelevant since it'll be lowered by the function call anyway.

When all lowercase characters are removed, 0xE0 becomes 0E0 which is 0 again, hitting the else block. Here we set $_ to "\U$_". \U is a strong modifier that makes the following part of the string uppercase.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Do you need the lc call? Seems like the \l handles that anyway. \$\endgroup\$ – Neil Jun 5 at 12:20
  • \$\begingroup\$ @Neil Unfortunately \L lowercases the whole string, \l only does the character immediately to the right: Try it online!. \$\endgroup\$ – Dom Hastings Jun 5 at 12:37
  • 1
    \$\begingroup\$ Ah, so the l is just a placeholder basically, so that there's still something after the `\`? \$\endgroup\$ – Neil Jun 5 at 12:40
  • \$\begingroup\$ Yeah, exactly. I tried to avoid having anything there but couldn't see a nice way to do it... \$\endgroup\$ – Dom Hastings Jun 5 at 12:42
13
\$\begingroup\$

APL (Dyalog Extended), 14 bytes (SBCS)

Anonymous tacit prefix function. Unmodified function:

'AAb'≢⍛⊃⊂,⍨⌊⍮⌈

Leaves argument untouched: Try it online!

Without lowercase letters:

'AA'≢⍛⊃⊂,⍨⌊⍮⌈

Uppercase argument: Try it online!

Without uppercase letters:

'b'≢⍛⊃⊂,⍨⌊⍮⌈

Lowercases letters: Try it online!


 the uppercased argument; "HELLO, WORLD!"

 pair to:

 the lowercased argument; [hello, world!","HELLO, WORLD!"]

,⍨ append:

 the entire argument; [hello, world!","HELLO, WORLD!","Hello, world!"]

 pick element number:

≢⍛ the length of:

  'AAb'/'AA'/'b' these three strings, i.e. number 3/2/1

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

05AB1E, 20 9 bytes

Byte-count more than halved (-11) thanks to @Dorian!

Full program:

lIq.•L•.V

Try it online.

With uppercase characters removed; outputting in lowercase:

lq.••.

Try it online.

With lowercase characters removed; outputting in uppercase:

I.•L•.V

Try it online.

Explanation:

          # Full program:
l         #  Lowercase the (implicit) input
 I        #  Push the input again
  q       #  Stop the program, after which the top of the stack is output implicitly
   .•L•.V #  No-ops

          # Program with uppercase characters removed:
l         #  Lowercase the (implicit) input
 q        #  Stop the program, after which the top of the stack is output implicitly
  .••.    #  No-ops

          # Program with lowercase characters removed:
I         #  Push the input
 .•L•     #  Push compressed string "u"
     .V   #  Evaluate/execute it as 05AB1E code; uppercase the (implicit) input
          #  (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to compress strings not part of the dictionary?) to understand why .•L• is "u".

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Why do you push the compressed string "chr" when you could simply push the compressed String "l" (lowercase L)? uIq.•C•.V \$\endgroup\$ – Dorian Jun 5 at 9:29
  • 1
    \$\begingroup\$ I think the question is asking for the opposite way around: when lowercase characters are removed the output should be uppercased, not lowercased, and vice versa. I believe lIq.•L•.V should do that for you \$\endgroup\$ – Mintable Jun 5 at 12:00
10
\$\begingroup\$

Javascript 192 characters (without \123 literals)

$=>'Aa'[1]?$:'a'?$['to\u004cower\u0043ase']():
z/A/g&&([,A,,S,E,,O,,,,C]=!1+{},[T,R]=!0+$,[U,N,,,,I]=1[0]+$,$[T+O+'U'+1199331[T+O+'S'+T+R+I+N+($[C+O+N+S+T+R+U+C+T+O+R]+$)[14]](36)+'C'+A+S+E]())

Javascript 197 characters (without \123 literals)

$=>'Aa'[1]?$:'a'?$['to\u004cower\u0043ase']():
z/A/g&&([,O,,,E,C]={}+$,[,A,,S]=!1+$,[T,R]=!0+$,[U,N,,,,I]=1[0]+$,$[T+O+'U'+1199331[T+O+'S'+T+R+I+N+($[C+O+N+S+T+R+U+C+T+O+R]+$)[14]](36)+'C'+A+S+E]())

Javascript 204 208 226 234 characters (without \123 numeric literals)

$=>'Aa'[1]?$:'a'?$['to\u004cower\u0043ase']():
a/A/g&&([,O,,,E,C]=JSON+$,[,A,,S]=!1+$,[T,R]=!0+$,[U,N,,,,I]=1[0]+$,P=25[T+O+'S'+T+R+I+N+($[C+O+N+S+T+R+U+C+T+O+R]+$)[14]](36),$[T+O+'U'+P+P+E+R+'C'+A+S+E]())

r=
$=>'Aa'[1]?$:'a'?$['to\u004cower\u0043ase']():z/A/g&&([,A,,S,E,,O,,,,C]=!1+{},[T,R]=!0+$,[U,N,,,,I]=1[0]+$,$[T+O+'U'+1199331[T+O+'S'+T+R+I+N+($[C+O+N+S+T+R+U+C+T+O+R]+$)[14]](36)+'C'+A+S+E]())


console.log(eval(String(r))('Sentence Case'));
console.log(eval(String(r).replace(/[A-Z]/g, ''))('Lower Case'));
console.log(eval(String(r).replace(/[a-z]/g, ''))('Upper Case'));

I didn't realise that you could make arbitrary characters with \123. It's a much more interesting challenge without :)

A couple of comments:

  • Some of the concepts are inspired by JSFuck, although the constraints are different. There is fortunately one global object whose name is entirely upper case letters, JSON, so we can directly harvest quite a few letters from [object JSON]
  • Other letters come from true, false and undefined. We take the letters we need to write constructor, which then means we can find the string representation of a random string's constructor, which starts function String() {...
  • That g is the last ingredient we need to then form the method name toString(), which in base 36 lets us turn any number into an equivalent lowercase letter.

The only other thing of note here is that once we remove all the uppercase letters from this branch path, it's not syntactically correct. So we turn it all into a // comment with a regex /A/g which turns into a comment. We end up with three completely different syntaxes for the three modes:

  • No removals: a/A/g&&(... one undefined variable divided by another by another.
  • Remove lower case: /A/&&(... a regex (always truthy) and the rest of the expression
  • Remove upper case: a//g&&... an undefined variable and a comment.

Javascript 272 characters

$=>'Aa'=='\u0041\u0061'?$:'a'=='\u0061'?eval('$.to\u0055pper\u0043ase()'):(
[,O,,,E,C]=JSON+'',
[,A,,S]=(''+!1),
[T,R]=(''+!0),
[U,N,,,,I]=(''+1[0]),
Ka=Ca+Oa+Na+Sa+Ta+Ra+Ua+Ca+Ta+Oa+Ra,
Ga=(''[Ka]+'')[14],
$[Ta+Oa+'L'+Oa+(32)[Ta+Oa+'S'+Ta+Ra+Ia+Na+Ga](36)+Ea+Ra+'C'+Aa+Sa+Ea]())

(Linebreaks inserted for readability)

Room to golf, but pretty excited that it even works. Took a lot of inspiration from JSFuck.

Whoops, I realised I got the functionality backwards: when you remove uppercase letters it uppercases, etc.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Can you write pper together? \$\endgroup\$ – l4m2 Jun 5 at 6:13
  • \$\begingroup\$ how do you mean? P,E and R are three different variables.. \$\endgroup\$ – Steve Bennett Jun 5 at 6:16
  • \$\begingroup\$ I mean $[T+O+'U'+697947..toString(30)+'C'+A+S+E] \$\endgroup\$ – l4m2 Jun 5 at 6:17
  • \$\begingroup\$ Also why use JSON rather than {}? \$\endgroup\$ – l4m2 Jun 5 at 6:32
  • \$\begingroup\$ Also claiming (without \123 numeric literals seems random assumption, does it work on strict mode? \$\endgroup\$ – l4m2 Jun 5 at 6:37
8
\$\begingroup\$

Bash, 107 characters

cC=echoECHO
cC=${cC,,}
cC=${cC::4}
[ c ]||cC+=(${@^^})
[ C ]||cC+=(${@,,})
[[ cC = ?? ]]&&cC+=($@)
${cC[@]}

Try it online!

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

Burlesque, 10 bytes

JZZzz#RjHD

Try it online!

This was a very fun one to puzzle out.

Explanation:

J            # Duplicate the input
 ZZ          # Uppercase it
   zz        # Lowercase it
     #R      # Rotate the stack right
       j     # Swap the top two elements in the stack (back to the original order)
        HD   # Hide the top (modified) element, returning the original input

Removing the lowercase letters gives us:

JZZ#RHD

Try it online!

Explanation:

J             # Duplicate the input
 ZZ           # Uppercase it
   #R         # Rotate the stack to the right
      HD      # Hide the top (unmodified) element, returning the modified input

And with uppercase letters removed:

zz#j

Try it online!

Explanation:

zz            # Lowercase the input
  #j          # Treats the stack as code to be run. Pops the string from the stack
              # and pushes it straight back in again to be implicitly output
| improve this answer | |
\$\endgroup\$
8
\$\begingroup\$

perl -p, 19 bytes

$A_=lc$_;$a_="\U$_"

Try it online!

A completely different solution than my earlier one. The program reads a line from the input (in the variable $_), does zero or more modifications, and prints that line (due to the -p flag). That is, it prints whatever ends up in $_.

As is, the input line isn't modified; its lower case variant is assigned to $A_, and its upper case variant to $a_, but both variables are otherwise ignored.

Removing the upper case letters gives us:

$_=lc$_;$a_="\$_"

Try it online!

Now, $_ is set to the lower case variant of itself. The variable $a_ is set to the literal string $_, but otherwise ignored.

If we remove the lowercase letters instead, we end up with:

$A_=$_;$_="\U$_"

Try it online!

Now we assign $A_ the input line, and ignore this variable. $_ is set to the uppercase variant of itself by using the special interpolation symbol \U, which upper cases the rest of the string, until it encounters \E, or the end of the string.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Very nice! .... \$\endgroup\$ – Dom Hastings Jun 5 at 12:39
  • 2
    \$\begingroup\$ Just realised you could use lcA instead oflc$_ for -1. \$\endgroup\$ – Dom Hastings Jun 5 at 17:36
8
\$\begingroup\$

Ruby, 106 bytes

Full version:

$_=[*$<]*''
$.=0
o_=97
O_=65
@_=->{$_[__=''<<$.+_]?$_[__]=''<<$.+(_^32):$.+=1;$.<27&&@_[]}
_&&=@_[]
$><<$_

Try it online!

Uppercase:

$_=[*$<]*''
$.=0
_=97
O_=65
@_=->{$_[__=''<<$.+_]?$_[__]=''<<$.+(_^32):$.+=1;$.<27&&@_[]}
_&&=@_[]
$><<$_

Try it online!

Lowercase:

$_=[*$<]*''
$.=0
o_=97
_=65
@_=->{$_[__=''<<$.+_]?$_[__]=''<<$.+(_^32):$.+=1;$.<27&&@_[]}
_&&=@_[]
$><<$_

Try it online!

Explanation:

The verbose part here is all about the no-lower-case version. Avoiding lower-case characters means the string replacement needs to use the syntax str[from] = to, wrapped in a loop via a lambda that calls itself. The lambda is the variable @_ defined using @_=->, and it's called via @_[].

Stepping through...

$_=[*$<]*'' : Read multiline input into the variable $_. (Depending on your interpretation of the spec, this could just be $_,=*$< for single-line input or even happen implicitly via the -p flag).

$.=0: Initialize the variable we'll be using to iterate over the letters of the alphabet.

o_=97: This initializes a variable that we never use. But if o, the only lower-case character in the program, is deleted, it's instead initializing _.

O_=65: Same but for upper-case.

@_=->{: Start the loop definition.

$_[__=''<<$.+_]: Check for the presence of a specific letter in the string (starting with "a".)

?$_[__]=''<<$.+(_^32): If it's there, swap its case.

:$.+=1: Otherwise, move on to the next letter.

$.<27&&@_[]}: Either way, repeat the loop as long as we haven't reached the end of the alphabet.

_&&=@_[]: If _ has been defined, run the loop. If it was defined as 97, we'll be caseswapping letters starting with 'a' (character code 97). If it was defined as 65, we'll start with 'A'.

$><<$_: Output.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The loop is genius. I like the workaround to avoid -p too. \$\endgroup\$ – Dingus Jun 7 at 0:45
5
\$\begingroup\$

SNOBOL4 (CSNOBOL4), 114 96 bytes

	OUTput =inPUT :(enD)
Den	OUTPUToutput =REPLACEreplace(INPUTinput,&LCASEucase,&UCASElcase)
END
end

Try it online!

T !

ry it online!

(Ab)uses SNOBOL's case-insensitivity and GOTO labels.

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

C (gcc), 78 76 73 72 68 bytes

__(_,$){$="";_[""-$]&&__(_+1,_[""-$]^=_[""-$]-('Aa'^32u)<26U?32:0);}

Try it online!

C (clang), 66 bytes

__(_,$){$="";""[$=_-$]&&__(_+1,""[$]^=""[$]-('Aa'^32u)<26U?32:0);}

Try it online!

Thank @G.Sliepen for fixing code for tio and pointing that the optimize work on clang!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Tried on duck.ac with extra __attribute__((optimize("-O0"))), works fine \$\endgroup\$ – l4m2 Jun 5 at 6:11
  • 1
    \$\begingroup\$ Very nice trick with ""-$ to get around the need for char*! \$\endgroup\$ – G. Sliepen Jun 5 at 7:50
  • \$\begingroup\$ @G.Sliepen $-'a'<26 is signed \$\endgroup\$ – l4m2 Jun 5 at 19:44
  • \$\begingroup\$ @G.Sliepen If uppercase removed 26U turns into 26 \$\endgroup\$ – l4m2 Jun 5 at 19:48
  • \$\begingroup\$ Ah, never mind! I forgot about that. \$\endgroup\$ – G. Sliepen Jun 5 at 19:50
4
\$\begingroup\$

Keg, 42 38 bytes

Turns out that and aren't implemented! That surely gives me a headache to implement that myself. (No TIO 'cuz the TIO interpreter has a bug. Use the offline interpreter instead.)

AAa!&ø?&¦3(:AZ•[ -]")|2(:za•[ +]")║_™^

Explanation

AAa                                    # Push the "magic string"
   !                                   # Find the length
    &                                  # Save the result into the accumulator
     ø                                 # Clear the stack
      ?&                               # Take input, append accumulator value
        ¦3(:AZ•[ -]")|2(:za•[ +]")║_™  # Default condition: directly return the input
                                     ^ # Reverse the stack

No lowercase letters:

AA!                                 # Here, the length of the "magic string" is 2
   &ø?&                             # Same as above
       ¦3                           # If the length of the stack is 2:
         (                          # Do this for every stack item:
          :AZ•                      # Is this in the A-Z range?
              [ -]                  # If so, lowercase it
                  ")|2(:•[ +]")║_™^ # Same as above

No uppercase letters works similarly.

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

JavaScript (Node.js), 84 81 bytes

_=>_['A'?'slice'||'\164\157U\160\160\145\162C\141\163\145':'to\x4cower\103ase']()

Try it online!

Trivial one

JavaScript (Node.js) work if \123 was an error, 170 bytes

$=_=>_['A'?'slice'||(/A/,[,A,,S,,,O,,,E,C]=!1+{},[T,R]=!0+_,[U,N]=_._+_,$[C+O+N+S+T+R+U+C+T+O+R](`P='\\${U}0070'`)(),T+O+'U'+P+P+E+R+'C'+A+S+
Ea):'to\Zx4cower\Zx43ase']()

Try it online!

JavaScript (Node.js) strict, 186 184 bytes

(_,[,A,,S,,,O,,,E,C]=!1+{},[T,R]=!0+_,[U,N]=_._+_)=>0xE0?_:_['A'?(/A/,(_=>_)[C+O+N+S+T+R+U+C+T+O+R]('U',`U[0]='\\${U}0070'`)(U=[]),T+O+'U'+U+U+E+R+'C'+A+S+
Ea):'to\Zx4cower\Zx43ase']()

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Ha, well there's a technique that would have saved me a lot of time and bytes if I'd known about it :) \$\endgroup\$ – Steve Bennett Jun 5 at 2:50
  • 1
    \$\begingroup\$ Oh, clever idea with the \\${U}0070. I thought of something ilke that but couldn't quite figure out how the escaping would work. \$\endgroup\$ – Steve Bennett Jun 7 at 4:20
3
\$\begingroup\$

Charcoal, 12 bytes

≡_¦_a↥S_A↧θS

Try it online! Link is to verbose version of code. Explanation:

≡_

Switch on _.

_a↥S

If it equals _a (i.e. never) then print the input uppercased.

_A↧θ

If it equals _A (i.e. never) then print the input lowercased.

Otherwise print the input unchanged.

With uppercase characters (including ) removed:

≡_¦_a↥_↧θ

Try it online! Explanation:

≡_

Switch on _.

_a↥_

If it equals _a (i.e. never) then print _ uppercased.

↧θ

Otherwise print the input lowercased.

With lowercase characters (including θ) removed:

≡_¦_↥S_A↧S

Try it online! Explanation:

≡_

Switch on _.

_↥S

If it equals _ (i.e. always) then print the input uppercased.

_A↧S

If it equals _A (i.e. never) then print the input lowercased.

Obviously both programs still work if you only delete ASCII upper/lowercase characters.

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

Befunge-98 (PyFunge), 51 bytes

<aaA^:~@#
, >-\:'``\'{^
^ 1>\:'@`\'[>\`**' *+
^ 01>

Try it online!

Try it online! (Uppercase letter removed)

Try it online! (Lowercase letters removed)

Explanation

Without removing any characters, most of the code is never executed. The code that does get executed is

<   ^:~@#
,
^
^   >

This reads each character sequentially with ~, duplicates it with :, and then prints the duplicate. Once the input runs out, ~ reflects the instruction pointer and @ ends the program. A copy of the input string is left on the stack, but it never gets printed, so we don't care about it.

With the uppercase A removed, the ^ on the top line moves one space to the left and the third line is executed rather than the second.

<  ^:~@#
,
^  >\:'@`\'[>\`**' *+
   1

This sequentially reads through the input with :~@# as before. Then, it puts a 1 on the stack, followed by two copies of the character. The two duplicates are compared against '@ and '[ (64 and 91 respectively) to see whether the character is an uppercase letter. If it is, the product of these checks (1*1=1) is multiplied by 1 and then by the code point of ​ (space) to get 32, which is then added to the original character to make it lowercase. However, if the character is not uppercase, one of the comparisons will return 0. This 0 gets multiplied by a bunch of things and then added to the original character, and so the character remains unaltered when it is printed.

With the lowercase as removed, the first ^ is now shifted over two spaces to the left, and the second line is executed rather than the fourth.

< ^:~@#
, >-\:'``\'{^
^ 1         >\`**' *+
  0

This does mostly the same thing, except -1 is pushed onto the stack rather than 1 at the beginning of the loop and the bounds are replaced with 96 and 123 (to see whether it is lowercase). Then, the ^ (we can't use v because it's lowercase!) shifts the IP down a line, to execute the same logic as before. If the character is a lowercase letter, 1 is multiplied by the top of the stack (which is now -1 rather than 1) and by 32 to get -32, which is added to the original character to make it uppercase. As before, if the character is not lowercase, 32 is multiplied by 0 and the final + does nothing.

In all cases,

<
,
^
^

is executed at the end of the loop, printing the possibly modified character and rerouting the IP back to the start.

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

Brachylog, 22 bytes

İḷ|f{;.P∧Ạ{∧Ṇ}ᶻ∋P∧|}ᵐ|

Try it online! try it online! TRY IT ONLINE!

I had some bizarre errors trying to use subscripted /. Takes a string through the input variable and outputs through the output variable, since printing is impossible without lowercase letters.

İ                         The input is an integer, but it's not,
 ḷ                        ...
  |                       so maybe...
   f                      its factors, but it doesn't have factors...
    {;.P∧Ạ{∧Ṇ}ᶻ∋P∧|}ᵐ     ...
                     |    so just output it unchanged.

 ḷ                        The input converted to lowercase
  |                       is the output.
  |f{;. ∧ {∧ }ᶻ∋ ∧|}ᵐ|    Hooray, that worked, forget everything else.

İ                         The input is an integer, except it's not,
  | {              }ᵐ     so then instead for each element of the input
     ;.                   that element paired with the output it's mapped to
       P                  is P,
        ∧                 and
         Ạ                the lowercase alphabet
          {∧ }ᶻ           zipped with (I don't actually know why this works!)
            Ṇ             a list of all printable ASCII characters (ABCDEFGHI...)
               ∋P         contains P
                 ∧        (which isn't the output);
                  |       if that's impossible pass the element through unchanged.
                     |    Since that worked, we don't worry about the rest.
| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

PHP (224 Bytes)

<?=!fPassthru(STDIN)&&0;__HALT_compiler();FUNCTIONfunction fPassthru(){returnRETURN STDIN;};functionFUNCTION __HALT_compiler(){ECHOecho                                                       STRTOUPPERstrtolower(STREAMstream_GETget_CONTENTScontents(Pfopen('php://stdin','r')));}

Uppercase version

<?=!P(STDIN)&&0;__HALT_();FUNCTION P(){RETURN STDIN;};FUNCTION __HALT_(){ECHO STRTOUPPER(STREAM_GET_CONTENTS(P('://','')));}

Lowercase version

<?=!fassthru()&&0;___compiler();function fassthru(){return ;};function ___compiler(){echo strtolower(stream_get_contents(fopen('php://stdin','r')));}
| 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.