cat goes "Meow"

We are all familiar with the concept of a cat program. The user types something in, it is echoed back to the user. Easy. But all cat programs I've seen so far have missed one fact: a cat goes "Meow". So your task is to write a program that copies all STDIN to STDOUT UNLESS the input is cat, in which case your program should output cat goes "Meow".


This is , so your score is your byte count, with a few modifiers:

  • If your program works for any additional animals other than cat (e.g. cow: cow goes "Moo"), for each additional animal: -10
  • If your program doesn't use the word "cat": -15
  • If your program responds to fox with "What does the fox say": -25

Animals and sounds that go together:

cow goes moo duck goes quack sheep goes baa bees go buzz frogs go croak

Anything else on this list is allowed.


  • Standard loopholes apply
  • You must not write anything to STDERR
  • You can use single quotes/no quotes instead of double quotes.


Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

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 leaderboard snippet:

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

var QUESTION_ID=62500;var OVERRIDE_USER=46470;function answersUrl(e){return"http://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"http://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>

  • 18
    \$\begingroup\$ For the bonuses: What does the fox say? \$\endgroup\$ Nov 1 '15 at 8:11
  • 1
    \$\begingroup\$ For the bonuses: can each additional animal be singular, or does "bees" always have to be plural, as in your list? \$\endgroup\$
    – ProgramFOX
    Nov 1 '15 at 9:06
  • 2
    \$\begingroup\$ Cats say meow.. \$\endgroup\$ Nov 1 '15 at 11:37
  • 1
    \$\begingroup\$ Instead of double quotes, can you use single ones? Also, can you output to stderr? \$\endgroup\$
    – Blue
    Nov 1 '15 at 12:47
  • 5
    \$\begingroup\$ Why is there no link to this in this challenge? \$\endgroup\$
    – Jan
    Nov 1 '15 at 20:50

64 Answers 64

1 2

Python 3, 516 - [10 x 53] - 15 = -29 bytes

lambda i:([i+f' goes "{a.split(",")[0]}"'for a in("bark,dog,wolf,seal,zebra bellow,alligator,moose,okapi bleat,deer,elk,giraffe,sheep,goat,lamb bray,donkey,ass buzz,bee,mosquito caw,crow,raven,rook chirp,cicada,cricket,songbird chuckle,linnet croak,frog,toad cry,swan hiss,goose,snake,tarantula meow,c"+"at moo,calf,cow,ox oink,pig,hog roar,badger,bear,lion,tiger,jaguar,leopard scream,monkey,peacock,vulture screech,bat,eagle,owl squeak,hamster,mouse,rat,rabbit,hare,tapir").split()if i in a.split(",")[0:]]+[i])[0]

Try it online!

Started with all the animals on the list, sorted into optimal groupings by sounds they make, then culled down animals whose bytes use more than 10. The final list contains 54 animals, for a bonus of -540 bytes.

It doesn't contain cat for another -15 bytes.

It's an anonymous function that works like a table with the animal sounds as headers, and finds the corresponding header for the animal in the table, otherwise returns the input.

If I'm allowed to respond to cat with cat goes "hiss" as in the list of animal sounds, I can pull off another 5 bytes.

-3 bytes thanks to Reinstate Monica.

  • \$\begingroup\$ @ReinstateMonica Thanks, I had it that way to handle multi-word animals, but I've removed them all. Cheers \$\endgroup\$ Dec 10 '19 at 19:44

Pyth, 132 - 150 (animals) - 15 (no cat) = -33 bytes

pJjb.zp.x++" goes \""r@.dmcd\ic."ay-ÝÏåâšB²ÅuŠ°µ²¦DIJÖì |t`2“‚Êôë¨}èÔèw:ÿÊ_OƒÄ<Ú›ø‚î½ùÛ&L°„6a<9-¾¹™,Uø0é6Œû²Ù²ËyÊ·%C"\lJ4\"k

Try it online!

Uses a packed string to fit in animals for less than 10 bytes each

Full list:

parrot goes "Squack"
cat goes "Meow"
rook goes "Caw"
ass goes "Bray"
goose goes "Honk"
dog goes "Woof"
duck goes "Quack"
sheep goes "Baa"
ox goes "Moo"
raven goes "Caw"
goat goes "Baa"
swan goes "Cry"
frog goes "Croak"
toad goes "Croak"
monkey goes "Chatter"

Edit 1: Almost forgot the no cat bonus :P


Japt, 18 bytes

r`^¯t$`È+` go ´ow

Try it


Gema, 24 characters - 15 = 9

\Ac\Lat\Z=$0 goes "Meow"

gema works like a filter, so an empty gema '' is the same as cat.

To avoid using the word “cat” literally, inserted a pointless \L (turns on line mode, like an inline -line switch, meaning following arguments can't cross line boundary).

Sample run:

bash-5.0$ echo -n cat | gema '\Ac\Lat\Z=$0 goes "Meow"'
cat goes "Meow"

bash-5.0$ echo -n cats | gema '\Ac\Lat\Z=$0 goes "Meow"'

Try it online!

1 2

Your Answer

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