Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

New answers tagged

3

6 languages, prints 80 //'Ÿ¯"y"«q áttatíu/* ";" åo 八 t? 十 t@ " io o oo @ "o 0o 1 K`ochenta (There's also 5/90 solution with a different approach in the edit history if you're interested) 05AB1E/English - eighty //'Ÿ¯"y"«q // # no-ops 'Ÿ¯ # push dictionary string "eight" "y" # push literal string "y" « # ...


2

3 Languages, 800 chars PHP, Norwegian, Outputs ÅTTE HUNDRE Emoji, Persian, Outputs هشتصد COW, English, Outputs EIGHT HUNDRED <?=['ÅTTE HUNDRE','⛽هشتصد🚘➡',' MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MMM MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO MoO ...


6

9 10 languages, 1000 bytes Asar (prints "tuhat", Estonian) Bash (prints "duizend", Dutch) C (prints "et tusind", Danish) C++ (prints "mille", Italian (or Latin if you prefer)) Brainfuck (prints "one thousand", English) Python 2 (prints "eintausend", German) Python 3 (prints "mil", Spanish) ><> (prints "jedna hiljada", Bosnian) Befunge-98 (prints "o mie", ...


1

3 languages, 05AB1E/Java 8/C, English/Dutch/German, 144 characters //…°¡Öƒ†ìq //\ interface M{static void main(String[]a){System.out.print("honderdvierenveertig"/* main(){{puts("einhundertvierundvierzig"/**/);}} Try it online in 05AB1E / English. Try it online in Java 8 / Dutch. Try it online in C / German. Will see if I'm able to add Whitespace and ...


1

Perl 6, 102 bytes {[~] <ΡΣΤΥΦΧΨΩϠ ΙΚΛΜΝΞΟΠϘ ΑΒΓΔΕϜΖΗΘ>>>.&{('',|$^b.comb)[$_/100*10**$++%*]}} Try it online!


0

PowerShell, 124 bytes inspired by Avi's answer for Java. $args-replace(($b='(?<=^|[?.!] )')+($q='\[\?]')+($v='(?= [aeiou])')),'An'-replace"$q$v",'an'-replace"$b$q",'A'-replace$q,'a' Try it online!


1

Java (JDK), 154 bytes s->{String v="(?= [aeiou])",q="(?i)\\[\\?]",b="(?<=^|[?.!] )";return s.replaceAll(b+q+v,"An").replaceAll(q+v,"an").replaceAll(b+q,"A").replaceAll(q,"a");} Try it online! Explanation: s->{ String v="(?= [aeiou])", // matches being followed by a vowel q="(?i)\\[\\?]", // matches being a [?] ...


2

05AB1E, 38 36 35 bytes 2FžNžM‚NèSðì…[?]©ìDu«D®'a'nN׫::}.ª Try it online or verify all test cases. Explanation: 2F # Loop 2 times: žN # Push consonants "bcdfghjklmnpqrstvwxyz" žM # Push vowels "aeiou" ‚ # Pair them together into a list Nè # And use the loop-index to index into this pair S ...


1

Retina, 66 60 bytes i`\[\?\]( ([aeiou]?)[a-z&&[^aeiou]) a$.2*n$1 (^|[.?!] )a $1A Try it online. Explanation: Do a case-insensitive search for [?] followed by a vowel or consonant, where the optional vowel is saved in capture group 2, and the entire match in capture group 1: i`\[\?\]( ([aeiou]?)[a-z&&[^aeiou]) Replace this with an a, ...


1

J, 113 bytes [:;:inv 3(0 2&{(((('aA'{~[)<@,'n'#~])~('.?!'e.~{:))~('AEIOUaeiou'e.~{.))&>/@[^:(<@'[?]'=])1{])\' 'cut' . '([,~,)] Try it online! Shame, shame!


0

Python 3, 104 103 bytes -1 bytes, unescaped ] lambda s:r('(^|[.?!] )a',r'\1A',r('a( [aeiouAEIOU])',r'an\1',r('\[\?]','a',s)));from re import sub as r Try it online! Starts by replacing all occurences of [?] with a, Then replaces all a followed by a vowel, with an. Then replaces all a at the start of input or a sentence with A. Assumes that [?] will ...


1

C (gcc), 225 207 202 bytes Thanks to ceilingcat for -23 bytes #define P strcpy(f+d,index("!?.",i[c-2])+!c? c;d;v(char*i,int*g,char*f){for(d=0;i[c];c++,d++)strcmp("[?]",memcpy(g,i+c,3))?f[d]=i[c]:(index("aeiouAEIOU",i[c+4])?P"An ":"an "),d++:P"A ":"a "),d++,c+=3);} Try it online!


Top 50 recent answers are included