# Create a program that prints the number of characters it has, in words

Create a program which prints the amount of characters its source has in English words.

If your program is nine letters long it should print "nine".

Capitalization is ignored: in case you're printing "one" (somehow) you can print "one", "oNe", "ONE" or anything else.

Base ten is required.

Proper spacing is also required.

In the (unlikely but just for specification) case your program reaches one billion characters or more, use the American number scale. A billion here is 10^9 and a million is 10^6.

Do not use "one hundred and one": use "one hundred one".

Do not use the hyphen. Print forty four, not forty-four.

Test cases with a fake program:

10.(96 0s later)..01 prints one HuNdreD ONE -- okay: proper spacing, no "and"
10.(96 0s later)..01 prints one HuNdreDONE -- not okay: wrong spacing
10.(96 0s later)..01 prints one thousand two hundred two -- not okay: base 3 rather than base 10
10...(999999996 0s later) prints nine hundred ninety-nine million nine hundred ninety-nine thousand nine hundred ninety-six: not okay, wrong number and includes hyphens


Golfy challenge, as always: shortest code wins. You're free to post after the green tick has been given, though. This serves more for completeness for hard to program languages. Malbolge, anyone?

• Proper spacing is also required. Does this mean no trailing spaces in the output? – Engineer Toast Oct 23 '19 at 12:14

## dc, 6 bytes

[six]P


prints:

six


# Hexadecimal Stacking Pseudo-Assembly Language, 80 bytes

200079400000200074400000200068400000
200067400000200069400000200045400000
140000


Try it online!

# Taxi, 164 bytes

"One hundred sixty four" is waiting at Writer's Depot.
Go to Writer's Depot:w 1 r 3 l 2 l.
Pickup a passenger going to Post Office.
Go to Post Office:n 1 r 2 r 1 l.


Try it online!

This also throws an error because I don't return the taxi to the garage so my boss fires me. It's not a requirement to not throw errors, though, so I guess I'm fired.

• Yeah, that's all and well. – Andrew Oct 22 '19 at 14:52
• Surely you can just.. remove the four – Jo King Oct 22 '19 at 22:55
• @JoKing Ha! You're right. I'll fix that tomorrow. (And don't call me Shirley.) – Engineer Toast Oct 22 '19 at 23:57

## T-SQL, 10 bytes

print'ten'


I guess is correct, right? :)

• What kind of SQL is this? I'm not aware of such a command/query, but I know you can do SELECT'fifteen'. – Night2 Oct 21 '19 at 17:45
• @Night2 It's Microsoft SQL Server. And yes, but that's 5 bytes more :P – JuanCa Oct 21 '19 at 18:01
• you should probably make this T-SQL as the language – MickyT Oct 21 '19 at 20:53
• @MickyT Thank you! – JuanCa Oct 22 '19 at 16:01

# Inform 7, 21 bytes

To q:say 21 in words.


This creates a function which takes no arguments and returns nothing, which prints the word "twenty-one".

Some boilerplate showing how to call the function:

X is a room.
When play begins: q.


Unfortunately, hardcoding the string tends to put me at a number of characters that's harder to print.

• Does this output a hyphen? If so, that's against spec unfortunately. – boboquack Oct 24 '19 at 7:12

# Python, 20 bytes

print("twenty")#lol.


hey! that's python code length is actually 20 characters. I know, It's cheating but the comment is still a text.

print("twenty")


prints the number. (15 chars)

#lol.


a useless comment. (5 chars)

so 5+15=20 and 20 is twenty, right?

• Please include the byte count in your submission. There's no reason to think that comments are cheating. As a hint, can you think of a smaller number that has a longer word, but fits without the comments? – Jo King Oct 23 '19 at 6:25
• Welcome to CGCC, I have updated your answer to include bytes count in the title and look better. If you like, you can use tio.run to provide an online working example of your code too. It also allows you to copy an auto generated answer with all the formatting ready to be posted. When you are done with your code, you can click on 🔗 icon and copy "Code Golf submission (Stack Exchange)" section here to post as an answer. – Night2 Oct 23 '19 at 8:42
• print("sixteen") – Jo King Sep 16 at 1:18

Some answers with "production" (i.e. non-golfing) languages still not mentioned here:

# C++ (clang), 55 bytes

#include<iostream>
int main(){std::cout<<"fifty five";}


Try it online!

# Scala, 23 bytes

println("twenty three")


Try it online!

main=putStr"twenty four"


Try it online!

• For Haskell you could do main=putStr"twenty four" – Sara J Oct 25 '19 at 11:05
• @SaraJ Thanks! Fixed. – trolley813 Oct 25 '19 at 11:12
• For all of these you can remove the digits part and just leave the fifty/twenty – Jo King Oct 26 '19 at 4:55

# Runic Enchantments, 6 bytes

"Six"@


Try it online!

This ended up being both much shorter and much less interesting than I anticipated. 3 bytes are required for syntax, making it impossible to go lower.

# Tcl, 9 bytes

puts nine


prints

nine


Try it online!

# Tcl, a lot more bytes (not finished yet) currently 42

this will read the source code counts the characters and convert the number into an actual number word.

content of c.tcl:

puts [string length [read [open c.tcl r]]]


prints:

% 42


# W, 5 bytes

five"


Implicitly prepends a quote. In order to specify your input, find prog.py and do this:

read = []

prog = 'five"'


# Wren, 26 bytes

Just a method that outputs a string literal.

System.write("twenty six")


Try it online!

• The number of quotes in your first program is definitely not odd... – Hello Goodbye Nov 18 '19 at 15:02
• W automatically "prepends" a quote z. – user85052 Nov 18 '19 at 23:15
• Ah, that makes sense. Interesting! – Hello Goodbye Nov 19 '19 at 20:39

Try it online! (six)S

# Explanation

(six)  Puts the text "six" onto the stack.
S      Prints it.


# Charcoal, 4 bytes

four


Try it online

The program just implicitly prints the string literal.

# VTFF, 1524 600 bytes

-924 bytes thanks to Jo King




VVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVFVFVFVVVVVVVVVVVVFVFVFVVVFVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVV


For info on how the lang works, I can't be bothered to rewrite it all, so see the old answer:




Those bytes can be seen in the source code of this answer. They could be earlier, but they're ap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VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVFVVV


Try it out here by putting the string "ONE THOUSAND FIVE HUNDRED TWENTY FOUR" in "Generate", then copying the output of that into "Interpret".

Explanation: VTFF is a language I found by hitting Random page on the Esolangs wiki a lot. The only characters are the vertical tab (0x0b) and form feed (0x0c), hereafter referred to as just V and F. Each block of V characters separated by F characters represents a number in unary. 32 is then added to that number and it is then converted into a character. This repeats until a string is built. That string is then sent to a JS eval statement, the output of which is the output of the program. Because the positions of out characters on the Unicode code table matter, capital letters are preferable to lowercase ones, because their unary representations are 32 bytes shorter. That said, if it ended up being 32 or 64 low I was happy to sprinkle in some lowercases if need be, but thankfully that didn't turn out to be the case. I obtained this with 15 minutes or so of manual brute forcing, where it quickly became clear that the 1500s would be easiest. If you automated the process, I imagine you could dip into the 1400s. Maybe there's even a really lucky one where you don't need all four digits. "FIVE HUNDRED" comes out at a frustrating 499 characters, for example.

Bonus fact: if you did this in binary VTFF (an imaginary language I just made up where it's just VTFF encoded in binary), you could get this down to just "FOURTY" bytes.

• Would binary work for "FORTY" as well? :P – Jo King Sep 22 at 22:00
• By adding some excess code, you can get this to "six" + " HUNDRED" – Jo King Sep 22 at 22:19
• @JoKing Awesome, I changed it. I might give this another shot later today to see if there's something yet more clever to be done. Five hundred feels so close! – Ethan Chapman Sep 22 at 22:31

## SWI-Prolog, 15 bytes

write(fifteen).


Try it online!

• Ten: write(ten)? – Night2 Oct 20 '19 at 9:17
• Apparently that works in the online version :) But in the terminal versions, we have to close it with a dot. – Anderium Oct 20 '19 at 9:25
• You can always limit your answer to a specific version. This is code golf, doesn't matter if the answer is not cross-compatible. – Night2 Oct 20 '19 at 13:53

# Pyth, 5 bytes

"five


Try it online!

I don't think it's possible to get shorter than this. The overhead for compressed strings is 4 bytes already, so it's impossible to also get a 4-byte message in it.

## MSM, 119 6 bytes

xsi/..


The 3 letters are pushed on the stack, / swaps s and i to get the correct (reverse) order and the two 3 dots concatenate them to a single string. There are variants such as '.xis. or ?..xis.

Try it online!

Edit: -3 bytes thanks to @Night2

# Husk, 3 bytes

¨◊ė


Try it online!

# Java 8 (full program), 75 bytes

interface M{static void main(String[]a){System.out.print("seventy five");}}


Try it online.

# Java 8 (lambda function), 9 bytes

v->"nine"


Try it online.

# Java 5/6 (full program), 40 bytes

enum M{A;{System.out.print("forty");}}//


No online compiler, because I don't know any for Java 5 or 6..
The trailing // are no-ops, but outputting forty is shorter.

# Pepe, 50 bytes

reeEEeeEEereeEEeEeeEreeEEeeEEereeEEEeEeereeEEEEeeE


Try it online!

# C (gcc), 29 bytes

main(){puts("twenty nine");;}


It's an actual program...

Try it online!

# C# (Visual C# Interactive Compiler), 18 bytes

Write("eighteen ")


Try it online!

# Gaia, 5 bytes

five”


Just a string literal that gets implicitly output.

Try it online!

# Malbolge, 30 bytes

('B;_#!~[|:9zVw/.uQrOqon&Jl6"'


Try it online!

Created with ZB3's Malbolge Tools

# International Phonetic Esoteric Language, 8 bytes

"eight"o (push and print "eight")


# Pip, 6 bytes

"six";


Try it online!

; is a comment.

• Also a polyglot in R, and this exact 'program' was even already submitted in R – Dominic van Essen Sep 16 at 6:22
• And, as a bonus, the other answer in R is also a polyglot in Pip – Dominic van Essen Sep 16 at 6:24
• I've been trying to find easy challenges for R, but all of them somehow have an R solution – Razetime Sep 16 at 6:53
• I don't think that should stop you from having a go. I wish there were more challenges with more-than-one answer in R (or any other language). It's really fun & instructive to see the different approaches. Obviously, one of them will always be the shortest, but that isn't a problem. I usually try to deliberately avoid looking at any other R answers if there already are any, and post my own answer if it ends-up different from whatever is already there, even if it's longer (and usually one of the other R golfers then makes it shorter for me anyway...). – Dominic van Essen Sep 16 at 7:03
• For instance, this recent challenge got 4 independent (and all different) R answers... – Dominic van Essen Sep 16 at 7:06

# MAWP, 30 bytes

99W3M!;98W!;1M;2A!;2M!;11MM3M;


Try it!

prints in capitals.

# naz, 30 bytes

9a9m3a1o9s3s1o1a1o9a1o2a1o5a1o


Outputs THIRTY.

# vJASS, 76 bytes

//! zinc
library zn{function onInit(){BJDebugMsg("seventysix")}}
//! endzinc


# StupidStackLanguage, 55 bytes

avvqmiifiiifdddfvvvdfvfavdqvdmfavvqmiifiiifvviiifwwwddf


Try it online!

I found this by generating a list of numbers 1 - 1000 as words, and then using my stupidstacklanguage printing tool to find the first item in the list of numbers which, when printed was the same length as the index of the number in the words array