text:
Determine whether strings are anagrams
Challenge
Given two strings, work out if they both have exactly the same characters in them.
Example
Input

word, wrdo

This returns true because they are the same but just scrambled.
Input

word, wwro

This returns false.
Input

boat, toba

This returns true
Rules
Here are the rules!

Assume input will be at least 1 char long, and no longer than 8 chars.
No special characters, only a–z
All inputs can be assumed to be lowercase

Test Cases
boat, boat = true
toab, boat = true
oabt, toab = true
a, aa = false
zzz, zzzzzzzz = false
zyyyzzzz, yyzzzzzy = true
sleepy, pyels = false
p,p = true

9 answers in 13 views... wow!

@Tom, because everyone wanted to prove that your comment about using a 64-bit integer was pointing in the wrong direction :P

Title request: Cod Elf, Go!

@user54200 Nah... it should be "Nag a ram Cod Elf, Go!"

"Falcon Rage, go mad!"

My name suggestion: "are they anagrams" → "manage the arrays"

Suggested test case: aaab, bbba = false

Python, 32 bytes
f=lambda a,b,S=sorted:S(a)==S(b)

Nice one!it makes me inquisitive to learn about lambda.

@Debanjan, This is just the same as def f(a,b):return sorted(a)==sorted(b) The trade off is that you get to replace def+return with lambda in exchange for not using any statements

Yes,and it's also saves few keystrokes,in my answer i further modified your answer to 2 bytes shorter :-)

@Debanjan, I think it only saves you one character. I have used a variation here, but it works out the same length as yours because I swap a newline for a comma

I have one question,this approach does require calling of input and print and other stripping functions right?

f(*'word,wrdo'.split(','))

Doesn't work. Does nothing when I run it in python. You have to write a complete program!

@Tomas, it's not rule abuse. Some questions are deliberately openended like this one appears to be. Compare with a well specified question like this. If you don't like these answers complain to the question asker

You don't need to include the f=.

Golfscript, 3 chars?
$$=

usage:
'boat'$'baot'$=
1

'toab'$'boat'$=
1

'oabt'$'toab'$=
1

'a'$'aa'$=
0

'zzz'$'zzzzzzzz'$=
0

'zyyyzzzz'$'yyzzzzzy'$=
1

'sleepy'$'pyels'$=
0

'p'$'p'$=
1

This is an interesting interpretation of how to supply the input :)

Explanation please :(

@st0le, seriously? I don't know golfscript, but it's obviously $ (sort), $ (sort), = (compare)

Isn't this cheating a little? I mean, it isn't variable input. It has to be hard-coded. In any case, I would add 4 to the character count for the quote (') characters.

to correctly handle the input use something like ", "/~$/$=

As a function: $\$=

This isn't valid by our current rules. You could, however, change it to @JanDvorak's 4-byte function, which would accept input via a valid input format.

@doorknob, I wouldn't know current rules at 2011. do as you wish, while you have power.

J, 8
-:&(/:~)

Literaly, match (-:) on (&) sort up (/:~)
Sample use:
   'boat' -:&(/:~) 'boat'
1
   'toab' -:&(/:~) 'boat'
1
   'oabt' -:&(/:~) 'toab'
1
   'a' -:&(/:~) 'aa'
0
   'zzz' -:&(/:~) 'zzzzzzzz'
0
   'zyyyzzzz' -:&(/:~) 'yyzzzzzy'
1
   'sleepy' -:&(/:~) 'pyels'
0
   'p' -:&(/:~) 'p'
1

Where do the 64-bit integers come into play?

Is it not possible to write functions/subroutines in J?

@Tim Nordenfur: they're called "verbs", and take either one argument on their right as in v arg (monads) or two on both sides as in arg1 v arg2 (dyads).  The one I submitted is obviously a dyad.  I didn't bother to name it, since it wasn't requested and is shorter this way.  Should you really want to give it a name, you'd do that like this: is_anagram_of =: -:&(/:~) and then use as 'a' is_anagram_of 'aa'.

It felt a bit cheap to substitute the arguments into the code, but I see now that it's essentially a dyad. Never mind.

J always looks like the remains of an emoticon factory explosion.

Javascript, 192 157 152 147 125 bytes
Ok some of these languages are a lot more flexibile than I thought!  Anyway this is the longer way I guess, but a different technique at least.
Compressed
Thanks to Peter and David for squeezing more chars out!
for(a=[j=p=2];j<123;)a[j]?p%a[++j]<1&&p++&&(j=0):(a[j]=p,j=0);function b(c,i){return c[i=i||0]?a[c.charCodeAt(i)]*b(c,++i):1}

Then do:
alert(b("hello")==b("elloh"));

Expanded Code
The compressed has had lots of changes, but this is the basic theory:
// Define dictionary of primes
a = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101];

// Returns the unique ID of the word (order irrelevant)
function b(c) {
    r = 1;
    for (i = 0; i < c.length; i++)
        r *= a[c[i].charCodeAt(0) - 97];
    return r
}

alert(b("hello") == b("hlleo"));

Great idea using primes.

@Tim thanks!  Got it down to 157 now.

You can shave a couple of characters off the dictionary initialisation using the sieve. a=[2];for(p=3,j=0;j<26;)if(a[j]){if(p%a[j++]==0){p++;j=0}}else{a[j]=p;j=0}

I feel like I read about this trick on some blog talking about interview questions...

@yc01, you may well have read about it in a book about computation theory. It's a classic way of encoding tuples for systems such as the Minsky register machine.

@Peter, thanks!  I think it's important to note with this technique it will be miles faster than anything else, as no sorting is involved.

@Tom, depends on how well optimised the sorting routines are, given that you've limited inputs to 8 characters :P

@Peter, a sorting algorithm best case would be O(n), realistically though this is not the case especially when using built in sorting algorithms.  Multiplying the values is always O(n) with very little overhead as well.  I was thinking about uses for this, and I think it would be a fast generic algorithm for search engines to find typos in user inputs, but they probably just use some sort of synonym list which is more efficient.

@Tom, not so. If you're going to bring big-O notation into it then you have to start taking account of the fact that (over a 26-char alphabet) a 64-bit integer is only good for 9 characters. Beyond that the size of the integer required is O(n), and multiplication is not O(1). But for very small inputs you've got to weigh the extra costs of sorting (which may well have special cases for n up to about 8) against the extra costs of handling the primes.

You can shorten the code more by initializing j and p to 2 within the dictionary's initialization, looping to 28, and then in b change 97 to 95. Also, you can initialize i in the primes generator and save another character there.

Because stackexchange will not implement multi-line comments I'm just going to spam this space with an explanation as to why I'm posting a revised code-snippet in a separate comment.

a=[r=j=p=2];for(;j<28;)if(a[j]){if(p%a[j++]==0){p++;i=j=0}}else{a[j]=p;j=0}function b(c){for(;i<c.length;i++)r*=a[c[i].charCodeAt(0)-95];return r}

In the snippet above I'm also initializing r to 2 instead of 1...it saves another character. I don't think this will mess up any results; the unique ids will just be 2x larger. In total, the changes I made bring it down to 146 characters.

Would it be cheating to pass c.length in as a parameter I wonder

hrm, initializing r outside of b() causes it to not work.

125 characters. Recursion and ternaries FTW: for(a=[j=p=2];j<123;)a[j]?p%a[++j]<1&&p++&&(j=0):(a[j]=p,j=0);function b(c,i){return c[i=i||0]?a[c.charCodeAt(i)]*b(c,++i):1}

@David, that's ridiculously clever well done!

@Peter I remember, I'd seen it here: http://news.ycombinator.com/item?id=1923298, but it was used in an answer to a different question. Still very cool, +1.

@David, you applied a trick once which could be applied twice: replacing p++&&(j=0) with (p++,j=0) saves a character. But you're overflowing a long with 'zzzzzzz', so proving correctness just got a whole lot harder.

i was wonder about accuracy myself. I tested "zzzzzzzz"!="zzzzzzzy" and it was false so I called it a day. :-)

Not much longer then a more "standard" approach of:
function t(a,b){a.split('').forEach(function(t){if(b.indexOf(t)==-1)return !1;});return(a.length==b.length)} 108 chars

Golfscript, 8 bytes
This defines a function called A
{$\$=}:A

Test cases
;
'boat' 'boat' A
'toab' 'boat' A
'oabt' 'toab' A
'a' 'aa' A
'zzz' 'zzzzzzzz' A
'zyyyzzzz' 'yyzzzzzy' A
'sleepy' 'pyels' A
'p' 'p' A

Haskell, 31 bytes
function - 31
import List
f=(.sort).(==).sort

program - 81 58 55
import List
g=sort`fmap`getLine
main=(`fmap`g).(==)=<<g

Usage:
$ runghc anagram.hs
boat
boat
True
$ runghc anagram.hs
toab
boat
True
$ runghc anagram.hs
a
aa
False

Kudos to lambdabot and its pointfree refactoring.

Can Haskell code that only does what's wanted under runghc, but not when compiled, still be called "program"?

@J B: Can Perl code that only does what's wanted under perl still be called a "program"?  :-)

J B: Todays functional languages skew the meaning of a program making it a higher order abstraction. Rather than just a list of instruction to be executed, as haskell program can just be seen as a collection of functions, even if they are not called.

@Callum Rogers: my point is: his code behaves differently whether run under runghc or compiled, in a problem-sensitive area.  The "function" is fine.  The "program" does not solve the problem under anything else than runghc, and runghc is not the only legitimate way to run Haskell programs.  In that context, that makes the snippet a "runghc script", not a "Haskell program". --not that I'd consider the issue important, as I said, the function is fine anyway and it's shorter.

I think you missed the "but not when compiled" part of my comment :-)

Alternate 55 char solution: import List main=fmap(length.nub.map sort.words)getLine

x#y=sort x==sort y is 1 character shorter

Where is the List module? Is that in some utterly ancient base library, or somewhere else?

@dfeuer Does this not compile with modern GHC?  It exists in Haskell 98, but maybe they got rid of it for good in Haskell 2010.

@JoeyAdams, the List module moved into the haskell98 compatibility package many years ago, when hierarchical modules showed up. As far as I can tell, that package is only available for GHC versions up to 7.8. I'm not sure if support was withdrawn intentionally, or if no one's gotten around to updating it in the last few years.

C#, 129 chars
namespace System.Linq{class X{static void Main(string[]a){Console.Write(a[0].OrderBy(_=>_).SequenceEqual(a[1].OrderBy(_=>_)));}}}

Readable:
namespace System.Linq
{
    class X
    {
        static void Main(string[] a)
        {
            Console.Write(a[0].OrderBy(_ => _)
                  .SequenceEqual(a[1].OrderBy(_ => _)));
        }
    }
}

I think you could golf a few bytes with using System.Linq; instead of namespacing it?

Ruby, 34 bytes
Using the IO scheme of Peter Taylors Perl solution:
p gets.chars.sort==gets.chars.sort

Throws an error: -e:1:in '<main>': undefined method 'chars' for nil:NilClass (NoMethodError)

C program, 118
t[52],i;main(c){for(;i<52;)(c=getchar())<11?i+=26:t[i+c-97]++;
for(i=27;--i&&t[i-1]==t[i+25];);puts(i?"false":"true");}

Ever considered applying for IOCCC?

@muntoo: have you seen anything in the IOCCC? This is way too readable for that.

@Martinho Yes, the IOCCC source codes are so beautiful. Symphonies. But he should at least try composing a small piece. :)

@muntoo: I didn't even know they were still active.

Just saw this one... Very nice. But can be shorter: t[256],i;main(c){for(;c+3;)(i=getchar())>10?t[i]+=c:(c-=2);for(i=257;--i&&!t[i-1];);puts(i?"false":"true");} - that's 108 characters. Very importantly, your c initialization trick is still employed.

@ugoren: Nice.  You add 1 for each character typed in the first line, then subtract 1 for each character typed in the second line.

Perl, 58 bytes
(complete program, unlike the other Perl answer which is only a function)
($c,$d)=map{[sort split//]}<>;print"@$c"eq"@$d"?true:false

49 as a function
sub f{($c,$d)=map{[sort split//]}<>;"@$c"eq"@$d"}

of course you can save 4 chars in the program by removing the " around true and false, since without using strict/warnings a bareword is a string.

Thanks!

I prefer this as ($c,$d)=map{[sort split//]}@ARGV;exit("@$c"ne"@$d") (51 chars) so it can take command line arguments and use the command line exit codes. It'd be 48 chars retaining <> with a multi-line input.

C++ (104 non-ws chars)

Based on counting sort.  Note: Assumes strings of the same length, which seems to be implied (though not stated) by the question.
int u[123], i;

int a(char **c) {
    for(; c[0][i]; ) {
        u[c[0][i]]++;
        u[c[1][i++]]--;
    }

    i=123;
    while(i && !u[--i]);
    return !i;
}

In C, if you declare a variable in the global scope, it is initialized to zero.  I guess this is also true for C++.

Local variables, on the other hand, are not initialized to zero automatically.

OK, I removed my caveat since I found ways to do without it.

Bzzzt. You pass the test cases, but "helle" and "hollo" are apparently the same. Easy fix: change one of the ++ to a --. Then just if (u[i++]) return 0;

@Dave Thanks for the catch, I was originally using 2 arrays and didn't think about that when I removed one.  Best part is, the correction makes it shorter!

I haven't tested this, but the last three lines can be written as i=123;while(i&&u[--i]);return!i;

@st0le Brilliant, thanks (you just missed a !).

@MatthewRead, doh! :)

If you call the above function a() with 2 words not anagrams, the next time one call that function can be not return the right result without zeroing the array u[123]

@RosLuP Code golf is for the shortest programs that solve the problem ("Given two strings..."), not for reliability.  You should also probably not bother critiquing posts here that are more than 5 years old.

Clojure - 23 chars
As an anonymous function:
#(apply = (map sort %))

Test case example:
(#(apply = (map sort %)) ["boat" "boat"])
=> true

Cool, I like it.

Nice answer. I particularly like the test strings you chose ;-)

JavaScript
Based on @zzzzBov's solution.
Comparison, 65 chars (40 without function)
function f(a,b){return a.split('').sort()==b.split('').sort()+""}

Comparator, 43 chars
function f(a){return a.split('').sort()+""}

Clever using the +"" to coerce to string.

APL, 2 chars
≡⍦

This is the Multiset Match function from Nars2000, one of the leading-edge APL implementations. When applied to strings, it computes exactly the function required:
      'elvis' ≡⍦ 'lives'
1
      'alec guinness' ≡⍦ 'genuine class'
1

Just curious, how many bytes is this? 4? 6?

It depends on the encoding. 6 bytes in UTF-8, 4 bytes in UCS-2, 2 bytes if any of the legacy single-byte APL charsets have the ⍦ symbol, which I doubt.

05AB1E, 6 4 bytes
{I{Q

Try it online!
This took a while because of input difficulties. Golfed down due to pop.
Explanation:
{I{Q    Original code

{       Takes first input e.g. word and sorts -> 'dorw'
 I      Takes second input e.g. 'wrdo'
  {     Sorts second input -> 'dorw'
   Q    Compare if sorted 1 = sorted 2, then print result. 'dorw' = 'dorw', so prints 1.

I know this answer is 5+ years old, but by taking the input as pair of strings, it can be 3 bytes: €{Ë

R, 54 bytes
function(x,y,`~`=sort,`+`=utf8ToInt)identical(~+x,~+y)

Try it online!

I'm highly intrigued by your use of utf8ToInt, not only in this answer, but in many others that I have seen.

Have you seen tips for golfing in R?  utf8ToInt and its reverse tend to make for shorter string-splitting than the conventional functions.

Knight, 112 bytes
;=dF;C=mB;=a 123W<96=a-a 1Id=d!E+"a"aE++"=a"a" 0";=w"+1a";C=lB;=bP:Wb;E++"=a"Ab+wAb=bGb 1Lb;=w"+~1a";Cl;=dT;CmOd

Try it online!
Knight doesn't have arrays. It does have strings, but it only allows a subset of valid ASCII character codes. So I emulated an array by constructing strings that looks like "=a{charcode} 0" and evaling it.
Knight also has blocks. A block works like a niladic function, which can change its behavior depending on global variables. This code uses two blocks: m loops over all 26 variables a97 - a122 initializing or testing something, and l handles the part of taking input and iterating over its chars to count occurrences.
; = d F                  d = False
; C = m B                define and run block m:
  ; = a 123                a = 123
  : W < 96 = a - a 1       while 96 < (a = a - 1):
    I d                      if d:
      = d ! E + "a" a          d = ! eval("a" + a)
      E + + "=a" a " 0"      else: eval("=a" + a + " 0") (aNN = 0)
                         i.e. d is false on start, so initialize all of a97..a122 to 0
; = w "+1a"              w = "+1a" (which is necessary to run l)
; C = l B                define and run block l:
  ; = b P                  b = one line of input
  : W b                    while b is not empty:
    ; E +                    eval(concatenation of
          + "=a" A b           "=aNN"
          + w A b              w+"NN") (aNN = 1 + aNN)
                             (w = "+~1a" changes this to aNN = -1 + aNN)
    : = b G b 1 L b          b = b[1:length(b)]
                         i.e. count occurrences of chars in the first line
; = w "+~1a"             w = "+~1a"
; C l                    run block l i.e. count negative occurrences in the second line
; = d T                  d = True
; C m                    run block m
                         for each of a122..a97, check if aNN is zero
                         if true, keep checking; otherwise do useless thing
: O d                    print d

Perl, 62 bytes
This function takes the strings as arguments and returns true or false.
sub f{my@a;for$.(1,-1){$a[ord]+=$.for split//,pop}!grep{$_}@a}

Stores the ASCII values in an array and checks if it evens out. Increments for the first word and decrements for the second word.

PHP (command line, 87 characters)
function d($s){
    return array_count_values(str_split($s));
}

echo d($argv[1]) == d($argv[2]);

Python 3, 107 97 76 64
s=sorted;a,b=input().split(', ')
print(str(s(a)==s(b)).lower())

Obviously this can be shortened if we don't take the OP's wording literally and lowercase "true" and "false"...

You can shave off a few characters if you append ;s=sorted to the first line and then replace the two instances of sorted with s in the second line. Should save... 3 characters?

Indeed. Python 3 also saves a bit of space, and is probably reasonable to use now, 5 years after this answer was posted. Also, the .strip() was redundant, given the specified inputs.

Yeah, sorry. I didn't notice how old this question was when I commented, only that it was on the frontpage. ^^;

Python, 32 bytes
p=sorted
f=lambda a,b:p(a)==p(b)

Does nothing in python. Are you sure it is a complete program that takes the input and produces the output as requested?

@Tomas It's a function

Bash, 88 characters
diff <(grep -o .<<<$1|sort) <(grep -o .<<<$2|sort)>/dev/null && echo true || echo false

Javascript
A (very) slightly shorter version of @zzzzBov's solution, that uses .join() instead of String boxing:
function a(b,c){return b.split('').sort().join()==c.split('').sort().join()}
alert(a('abc','bca')); //true

Similarly:
function a(b){return b.split('').sort().join()}
alert(a('abc')==a('bca')); //true

this is answer ID 1337. congratz

Clojure REPL 41 chars
(= (sort (read-line)) (sort (read-line)))

Welcome to the Stack Exchange network. Formatting help here.

Java
(everyone's favorite language apparently!)
173 chars:
import java.util.*;class g{public static void main(String[]p){String[]a=p[0].split(""),b=p[1].split("");Arrays.sort(a);Arrays.sort(b);System.out.print(Arrays.equals(a,b));}}

(Doesn't print newline char to save 2 chars from println)
Compile and run:
javac g.java
java -cp . g abcdef fedcba
true

Love to see a shorter one...

I know it's been more than 6.5 years (lol), but you can golf it by 10 bytes by adding java.util.Arrays x=null; and use x. instead of Arrays.: class g{public static void main(String[]p){java.util.Arrays x=null;String[]a=p[0].split(""),b=p[1].split("");x.sort(a);x.sort(b);System.out.print(x.equals(a,b));}} (163 bytes) And by converting it to Java 8, class g{public static void main could be interface g{static void main as well, but I guess Java 8 wasn't around yet in 2011, so keeping class is also fine. ;p

sed, 45 chars
It's even possible in my favourite - sed! Just one regular expression to solve the anagram! Just keep removing the corresponding letters:
:
s/(.)(.*,.*)\1/\2/
t
/\w/{i\false
d}
i\true

(to be invoked with -nE)
Perl, 48
1while s/(.)(.*,.*)\1/\2/;$_=/\w/?"false":"true"

To be invoked with -p.
Perl function, 39
sub f{$,while s/(.)(.*,.*)\1/\2/;!/\w/}

One less: sub f{1while s/(.)(.*,.*)\1/\2/;!/\w/}

Perl, 77 75 chars
The I/O of the problem aren't well specified; this reads two lines from stdin and outputs true or false to stdout.
sub p{join'',sort split'',$a}$a=<>;$x=p;$a=<>;print$x eq p()?"true":"false"

(Thanks to Tim for 77 -> 75)

Something is wrong. $a=;? Also, you can skip the parens of sort and the space after print.

@Tim, the genius who developed this platform for sharing code over the net decided that in code blocks people should have to escape less-than characters. But hey, no big deal: it's not as though anyone uses them in code, right? Keeps catching me out.

Ok, I removed the downvote. You might want to use the code formatting in the future, i.e. indent code with four spaces.

Ok, so there are three ways of formatting code (one inline and two block), and both the block ones are inconvenient in different ways. Sigh.

JavaScript, 41
Comparison function (41):
a=b=>''+[...b].sort()
b=(c,d)=>a(c)==a(d)

alert(b('abc', 'cba')) // true

Comparator function (21):
a=b=>''+[...b].sort()

alert(a('abc') == a('bca')); //true

Comparator function (48):
function a(b){return String(b.split('').sort())}

alert(a('abc')==a('bca')); //true

Comparison function (78):
function a(b,c){return String(b.split('').sort())==String(c.split('').sort())}

alert(a('abc','bca')); //true

Assumes String has split and Array has sort.

38 bytes: c=>d=>(a=b=>''+[...b].sort())(c)==a(d)

Scala in REPL (32)
readLine.sorted==readLine.sorted

Scala function (43)
def f(a:String,b:String)=a.sorted==b.sorted

Scala program (61)
object A extends App{println(args(0).sorted==args(1).sorted)}

These leverage a neat feature of Scala whereby a String can also be treated as a sequence of characters (Seq), with all the operations on Seq being available.

APL - 13 chars
{(⍺[⍋⍺])≡⍵[⍋⍵]}

Call like this:
      'boat' {(⍺[⍋⍺])≡⍵[⍋⍵]} 'baot'
1
      'baot' {(⍺[⍋⍺])≡⍵[⍋⍵]} 'boat'
1
      (,'a') {(⍺[⍋⍺])≡⍵[⍋⍵]} 'aa'
0

In the last example, 'a' represents a single character, and the prefix , will convert it into a string.

Java (134 bytes)
int[][]c=new int[2][26];
for(int i=0;i<2;i++)for(byte a:args[i].getBytes())c[i][a-97]++;
System.out.print(Arrays.equals(c[0],c[1]));`

This makes an array to count the number of times each letter appears, and then compares the arrays to check if they are equal.

Welcome to PPCG! Nice first post! There are 2 spaces you can remove, (c[0], c[1]) and for (int i=0;.

Brain-Flak, 170 bytes
{({}[(()()()()()){}]<>)<>}<>([]){{}(<>())<>{({}[(((((()()()()()){}){}){})){}])({({})({}[()])()}{}{}())({<({}[()])><>({})<>}{}<><{}>)<>}{}([])}<>({}[{}])((){[()](<{}>)}{})

Try it online!
Takes input on two lines.
This program makes a Gödel encoding of letter frequencies in each string. This means I need to map each letter to a unique prime number. For that, I use the polynomial n^2 + n + 41, which is known to give prime results for 0 <= n <= 40. I subtract 90 from the ascii code for each letter before passing it to the polynomial, to get a number in the proper range. When the primes are multiplied together, the results should be equal only when the strings are permutations of each other.

Husk, 2 bytes
€P

Try it online!
Returns index of the permutation found, or 0.

Haskell, 31 bytes
import Data.List
s%t=s\\t==t\\s

Try it online!
The \\ operator from Data.List is multiset difference. If s and t and anagrams, then s\\t is empty, as is t\\s. However, if any character appears in s more times than in t, then s\\t will contain it whereas t\\s won't, making  them unequal, and vice versa is the character appears in t more than s.
36 bytes
(.q).(==).q
q=sum.map((9^).fromEnum)

Try it online!
A shot at an import-less solution. Each string is converted to a base-9 representation of its character counts, and these are checked for equality. The i'th digit base 9 is the number of appearances of the character with fromEnum ASCII value i. This takes advantage of the spec guaranteeing each string is no longer than 9 characters, so there's no rollover in base 9.
39 bytes
s%t=and[q s==q t|q<-filter.(==)<$>s++t]

Try it online!
A more general solution following the principles of avoiding sorting. Checks that each character in s++t appears as many times in s as it does in t.

Regex (PCRE), 65 bytes
^((?=(.))(?!(.*?\2(?=.*
(\4?+.*?\2)))*+.*\2)(?=.*
(\5?+.)).)*
\5$

Try it online! - test cases
Try it on regex101 - try it on your own
Takes the input strings delmited by newline.
This asserts that both:

For each character in the first string, the second string contains that character at least as many times as it occurs in the first string
The second string is equal in length to the first

^              # Assert that we're starting at the beginning of the first word.
(
    (?=(.))    # Match and capture a character in \2, without consuming it.
    # Assert that the second has at least as many occurrences of \2 as there
    # are subsequent occurrences of it in the first word (including the one we
    # just captured above).
    (?! # Negative lookahead - assert the following can't match, and also
        # conveniently erase whatever capture groups it creates when finished.
        (
            .*?\2     # Match up to the next occurrence of \2 in the first word
                      # (which will be the first one when this loop starts)
            (?=
                .*¶           # Skip to the second word.
                (             # \4 = the following:
                    \4?+      # previous value of \4, if any
                    .*?\2     # Match up to the first subsequent occurrence of
                              # \2 in the second word (which will be the first
                              # occurrence when this loop starts)
                )
            )
        )*+           # Loop the above possessively, locking in each iteration
                      # atomically as it matches.
        .*\2          # Assert \2 occurs again in the first word.
    )
    # Append one more character from the second word onto \5, building up \5
    # to have the same number of characters of the second word as characters
    # we have finished processing in the first word.
    (?=
        .*¶           # Skip to the second word.
        (             # \5 = the following:
            \5?+      # Previous value of \5, if any
            .         # One additional character
        )
    )
    .          # Skip over the \2 just processed in the first word.
)*             # Iterate the above as many times as possible.
¶              # Assert we've reached a newline, meaning we've processed the
               # entire first word, and advance to the second word.
\5$            # Assert that the second word is of equal length to the first.

It only takes +1 byte (66 bytes) to add support for zero-length words:
^((?=(.))(?!(.*?\2(?=.*
(\4?+.*?\2)))*+.*\2)(?=.*
(\5?+.)).)*
\5?$

Try it online! - test cases
Try it on regex101 - try it on your own
Regex (.NET), 70 bytes
^(((.))(?=((?<2>\2)|.)*)(?=.*
(?(\2)(?<-2>.)|.)*$(?(2)^)))*
(?<-3>.)*$

Try it online! - test cases
Try it on regex101 - try it on your own
This asserts that both:

For each character in the first string, the second string contains that character at least as many times as it occurs in the first string
The second string is not longer than the first

Although it is not required, this works even with zero-length words (for free; there is no golf sacrifice in doing so).
^              # Assert that we're starting at the beginning of the first word.
(
    ((.))      # Consume a character and capture it in both \2 and \3.

    # Assert that the second word has at least as many occurrences of \2 as
    # there are subsequent occurrences of it in the first word (including the
    # occurrence we just consumed). This only needs to be asserted for the first
    # occurrence of each character in the first word (because on each subsequent
    # occurrence, the count of subsequent occurrences will be one fewer than
    # before) but for golf reasons, it's harmless to do it for every occurrence.

    # Step 1: Push every additional occurrence of \2 onto the \2 stack.
    (?=               # Atomic lookahead
        (
            (?<2>\2)  # Pop a capture off \2 and match it.
        |        # or
            .         # Match a single character.
        )*            # Iterate the above as many times as possible.
    )

    # Step 2: Assert that the second word has at least as many occurrences
    # of \2 as were counted above.
    (?=
        .*¶           # Skip to the second word.
        (?(\2)        # For each character in the second word, if it
                      # matches \2, match the following:
            (?<-2>.)  # Pop that capture off the \2 stack, and consume the
                      # character.
        |             # Else, match the following:
            .         # Consume the character.
        )*$           # Iterate the above until reaching end of string.
        (?(2)^)
    )
)*             # Iterate the above as many times as possible.
¶              # Assert we've reached a newline; advance to the second word.
(?<-3>.)*$     # Assert that this word is not longer than the first word, by
               # popping every capture from the \3 stack and matching one
               # character of the second word (it doesn't have to match \3)
               # for each.

Regex (Perl / PCRE), 71 bytes
^((?=(.))(?4)(?=.*
(\3?+.)).)*
\3$((?!(.*?\2(?=.*
(\6?+.*?\2)))*+.*\2))

Try it online! - Perl
Try it online! - PCRE2
Perl doesn't erase capture groups upon exiting from a negative lookahead. For compatibility with it, this version uses a subroutine call (?4) instead of a negative lookahead to erase the necessary capture group. The subroutine is then executed again, harmlessly, after the regex finishes and reaches the end of the string (for golf reasons, it is not hidden in a (?(DEFINE)...) block or similar construct).
Regex (PCRE / .NET), 74 bytes
^((?=(.))(?!(?>(.*?\2(?=.*
((?>\4?).*?\2)))*).*\2)(?=.*
((?>\5?).)).)*
\5$

Try it online! - PCRE2
Try it online! - .NET
This is the PCRE version ported to be compatible with .NET, replacing possessive quantifiers with atomic groups.
Regex (PCRE / Ruby), 87 bytes
^((?=(.))(?!(.*?\2(?=.*
(\5?+.*?\2))(?=.*
(\4)))*+.*\2)(?=.*
(\7?+.))(?=.*
(\6)).)*
\6?$

Try it online! - PCRE
Try it online! - Ruby
This is a port of the 65 byte PCRE version, using back-and-forth copying of \4↔\5 and \6↔\7 to avoid use of nested backreferences, which aren't supported by Ruby.
For a reason I have yet to determine, this doesn't work on Pythonregex, even its latest version.
Regex (Perl / PCRE / Ruby / .NET), 147 bytes
^((?=(.))(?!(?>(.*?\2(?=((?!.*\2)|.))(?=.*
((?!.*$\4)(?>\6?).*?\2|(?=.*$\4)(?=(?>\6?).*?\2)))(?=.*
(\5)))*).*\2)(?=.*
((?>\8?).))(?=.*
(\7)).)*
\7$

Try it online! - Perl
Try it online! - PCRE2
Try it online! - Ruby
Try it online! - .NET
This is a rather interesting challenge for writing a regex polyglot.
Supporting both Perl and Ruby/.NET is rather difficult. The problem is finding a way to erase the capture group that is created inside a negative lookahead in the PCRE version. Erasing capture groups in situations like this can be a challenge, and to support this combination of regex engines, we can't use negative lookahead (Perl doesn't erase it), a subroutine call (because Ruby's syntax is incompatible with Perl, and .NET doesn't have them), a branch reset group (neither Ruby nor .NET support them), or capture group aliasing or explicit erasure (only .NET has those).
So we must signal to the place where the capture is normally made, to erase it when it needs to be erased. The method I settled upon here is rather convoluted, but it works. (It would be shorter with a lookaround conditional, but we can't one, as Ruby doesn't have them, and .NET's syntax for them is different.) This post is already pretty long, so here's a link to the commented version.

Python, 151, 89 bytes
Handles arbitrarily many inputs from stdin.  Comma separated, one pair per line.
import sys
f=sorted
for l in sys.stdin:a,b=l.split(',');print f(a.strip())==f(b.strip())

Mwahaha, first time I see a Python solution longer than C# :)

Won't this return True for aab, bba?

@gnibbler; Yes, it will, I wasn't thinking this morning.  Fixed

JavaScript (67)
function(a,b){return ""+a.split("").sort()==""+b.split("").sort()}

Wanted to post the same solution before I even saw yours

VBScript
172 characters
wscript.echo "boat, boat         = " & s("boat, boat")
wscript.echo "toab, boat         = " & s("toab, boat")
wscript.echo "oabt, toab         = " & s("oabt, toab")
wscript.echo "a, aa              = " & s("a, aa")
wscript.echo "zzz, zzzzzzzz      = " & s("zzz, zzzzzzzz")
wscript.echo "zyyyzzzz, yyzzzzzy = " & s("zyyyzzzz, yyzzzzzy")
wscript.echo "sleepy, pyels      = " & s("sleepy, pyels")
wscript.echo "p,p                = " & s("p,p")

function s(a):b=split(replace(a," ",""),","):c=0:for x=1 to len(b(0)):if instr(b(1),mid(b(0),x,1)) then c=c+1
next:if len(b(1))-c=0 then s=true else s=false
end function

I was kinda suprised I could get it under 200.

131 characters if I pass the values seperatly.
function s(a,b):c=0:for x=1 to len(a):if instr(b,mid(a,x,1)) then c=c+1  next:if len(b)-c=0 then s=true else s=false end function

Ruby (40)
a.unpack('c*').sort==b.unpack('c*').sort

I've formatted your code for you. The tool bar above the edit box has the most commonly used functions, and the sidebar has a link to more detailed info.

Another Ruby (46)
(a.size==b.size)&&(a<<b.count(a,b)==a<<b.size)

C function (147 chars), using brute-force
int c(char*x,char*y){int i=0,l=0;for(;y[l]&&x[l];l++);if(y[l]||x[l])return 0;
while(*x&&i!=l){for(i=0;i<l&&y[i]!=*x;i++);y[i]=0,x++;}return(i!=l);}

Ruby 1.9 - 32
x=->{gets.chars.sort}
p x[]==x[]

Cool! x=->{gets.sum} passes the test cases but is kind of a cheat.

BTW, why 1.9.1 and not 1.9.2? It works in 1.9.2.

That's just the version of Ruby 1.9 I have.

Ruby (39)
Accepts the input as given in the question. Run with ruby -n.
$ cat t.rb
$_=~/, /;p $'.chars.sort==$`.chars.sort

$ echo -n "word, wrdo" | ruby -n t.rb
true

Finally a nice solution that works!

(Two years later...) You can omit the first three characters ($_=). In -n mode ~/x/ is equivalent to /x/ =~ $_. You can also omit the space between p and $.

R, 77
f=function(x,y)identical(sort(strsplit(x,"")[[1]]),sort(strsplit(y,"")[[1]]))

Sample output:
f("boat","boat")
[1] TRUE
f("toab","boat")
[1] TRUE
f("oabt","toab")
[1] TRUE
f("a","aa")
[1] FALSE
f("zzz","zzzzzzzz")
[1] FALSE
f("zyyyzzzz","yyzzzzzy")
[1] TRUE
f("sleepy","pyels")
[1] FALSE
f("p","p")
[1] TRUE

Why not simply f=function(x,y) identical(sort(strsplit(x,"")[[1]]),sort(strsplit(y,"")[[1]]))?

You're completely right! Stupid me! I replaced the code with your solution.

Matlab: 10 characters without using sort
a*a'==b*b'

Haskell, 48

Not counting imports, Haskell can do it in 10 chars:
import Data.List
import Data.Function
on(==)sort

Called like this:
λ> on(==)sort "balaclava" "aabllcav"
False

λ> on(==)sort "balaclava" "aabllcava"
True

Julia - 36
f=s->==(map(sort,map(collect,s))...)

Used as f(["foo", "bar"])
Using a list for calling it kind of feels like cheating though.
43 characters
f=(a,b)->sort(collect(a))==sort(collect(b))

Used as f("foo", "bar")
Both solutions just sort the words and compare the result

Woohoo, my first real CodeGolf submission ^_^
Mathcad, 38 chars including non-character keys
s(a):sort(str2vec(a))
f(a,b):s(a)©=s(b)

© stands for the Ctrl key.
Displayed by Mathcad formatted as:
s(a):=sort(str2vec(a))
f(a,b):=s(a)=s(b)

Converts the strings to vectors (one-dimensional arrays) of symbols' ASCII values, sorts them, then compares the vectors. Input is supplied to function f. Returns 1 on success and 0 on failure.
Example:
f("toab","boat") returns 1

Pyth 10 7
qFSMczd

Takes input as two space-separated words.
Try it here.
Essentially, it splits the elements into an array, sorts each element, and checks if the elements are unique.
My first attempt at Code Golf.  Any advice appreciated :o)

I got this to 8 bytes: !.{SMczd. If you accept input in the form ['wrod','word'], you can get it to 6 bytes: !.{SMQ.

Also, you can replace !.{ with qF, giving you 7 bytes with the current input method and 5 with the other one I mentioned.

Thank you both!  I made a note mentioning how the answer is valid for the problem, and changed my code accordingly.

Perl, 41 bytes
40 bytes code + 1 for -p.
Since this uses a slightly different trick to the other Perl answers I thought I'd share it. Input is separated by newlines.
@{$.}=sort/./g}{$_="@1"eq"@2"?true:false

Uses the magic variable $. which tracks the line number to store the words, as character lists, in @1 and @2 which are then compared.
Usage
perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'wrdo
word'
true

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'word
wwro'
false

perl -pe '@{$.}=sort/./g}{$_="@1"eq"@2"?true:false' <<< 'boat
toba'
true

Try it online.

PHP, 44 Bytes
<?=($c=count_chars)($argv[1])==$c($argv[2]);

Brachylog, 2 bytes
pᵈ

Try it online!
The p predicate is essentially a declaration that the variables on either side of it are permutations of each other. The ᵈ meta-predicate modifies the predicate to which it is attached to interpret the input variable as a list of two items, which are effectively placed on either side of the predicate (with the output variable being unified with the second element of the input). So, given a pair of strings as input, the predicate pᵈ will succeed if they are anagrams, and fail if they are not.
If anyone's suspicious of the header on TIO, it just goes through the list of test cases and prints a list of "true"/"false" values based on whether the predicate succeeded or failed for each case. The predicate can be run as a standalone program that prints "true." if it succeeds for the single test case it is given and "false." if it fails.

Caveat (?): takes a list of two strings, doesn't do anything to parse a one-string input, some people seem to have been worried about that on their answers but those were also different times so I'm not sure what to think
Also, technically, the one-byte p would count, but I'd have a hard time justifying that as an answer (plus it's nice to finally have a good use for the declare metapredicate).

Curry, 49 bytes
Tested in PAKCS
e#x=e:x
e#(x:y)=x:e#y
p(x:y)=x#p y
p[]=[]
(=:=).p

Try it online!
Try it on Smap!
This returns True if inputs are anagrams and nothing otherwise.
Explanation
This is a really fun Curry solution.  First we define a function p which gives a non-deterministic permutation of the input.
Then our submission is just (=:=).p.  Written more normally this is:
f x y = p x =:= y

Meaning it tries to bind y to a permutation of x.  If they are anagrams this succeeds and gives True, if they are not there is no binding and we get nothing.

31 bytes.

Knight, 92 68 bytes
Saved 21 bytes (and indirectly 3 more) thanks to Bubbler
O?C=sB;=wP;=j~9;W=j+1j;=i 8Wi=wI>=bGw i 1=aGw=i-i 1 1wSw i 2+b a wCs

Try it online!
Explanation
Sorts both strings using a bubble-sort algorithm and checks if they are equal. The sorting algorithm takes advantage of the "input will be ... no longer than 8 chars" rule.
Ungolfed:
;= sort_input BLOCK
 ;= word PROMPT
 ;= j ~9
 ;WHILE = j (+ 1 j)
  ;= i 8
  :WHILE i
   := word
    ;= char2 GET word i 1
    ;= char1 GET word (= i (- i 1)) 1
    :IF > char2 char1
     :word
     :SUB word i 2 (+ char2 char1)
 :word
:OUTPUT ? (CALL sort_input) (CALL sort_input)

71B: O?C=sB;=wP;=j~9;W=j+1j;=i~1W>9=i+1i=wI<=xGw+1i 1=yGw i 1wSw i 2+x y wCs Changes: move ;=wP into the block body; use return value of C to avoid =v w; move increments into the loop condition; store 1-char substrings in variables; swap two branches of I to save a space.

@Bubbler Thanks! I started thinking of blocks as subroutines because they don't take arguments--forgot that they do have return values. I found another golf by running the i loop in the opposite direction and updating i in the loop body instead of the header.

Knight, 59 52 bytes
O?C=bB;=aP;=x*"0"128;Wa;=xSxAa 1+1GxAa 1=aGa 1La xCb

Try it online!
For both inputs, it creates a 128-character string of 0s, then iterates through the input and increases the value in the index associated with the ASCII code of the given character. Finally, it compares these strings.
This only works because the input strings are less than 8 characters, meaning there can be at most 8 of a single character (less than the 9 that can be stored in a single index by this encoding).
Expanded code:
;=b BLOCK
  ;=a PROMPT
  ;=x *"0" 128
  WHILE a
    ;= x (SET x (ASCII a) 1 (+1 (GET x (ASCII a) 1))
    = a (GET a 1 (LENGTH a))
;CALL b
;=y x
;CALL b
OUTPUT (? x y)

-7 bytes from @Bubbler

52 bytes O?C=bB;=aP;=x*"0"128;Wa;=xSxAa 1+1GxAa 1=aGa 1La xCb using the same refactor as DLosc's solution.

Vyxal, 2 bytes
Þ⊍

Try it Online!
Takes two strings pushed separately onto the stack as input. Returns inverted output (falsey if the strings are anagrams of each other, truthy if they are not).
Þ⊍  # Multiset Symmetric Difference - yields a list of the characters in A that
    # aren't in B and the characters in B that aren't in A. Will be empty iff A
    # is an anagram of B.

Vyxal, 3 bytes
Þ⊍¬

Try it Online!
Takes two strings pushed separately onto the stack as input. Returns 1 if the strings are anagrams of each other and 0 otherwise.
Þ⊍  # Multiset Symmetric Difference - yields a list of the characters in A that
    # aren't in B and the characters in B that aren't in A. Will be empty iff A
    # is an anagram of B.
¬   # Logical Not - When used on a list (as is the case here) returns 1 for an
    # empty list and 0 for a non-empty list (even a list containing one 0 in it)

Vyxal, 3 bytes
vs≈

Try it Online!
Takes a list of two strings as input. Returns 1 if the strings are anagrams of each other and 0 otherwise.
vs  # Vectorized sort (sort the characters in each individual item)
≈   # All Equal

Knight, 51 bytes
O?C=cB;=iP;=x*'0'256;Wi;=xSx=aAiT+1Gx aT=iSiF1""xCc

Try it online!
This challenge was made a lot easier because inputs were length 8 maximum. That way, we could have a string of length 256, where each index is the amount of times that byte appeared in a word. Then, we can just compare them.
Ungolfed and reorganized slightly, with copious comments:
# Create a new block (ie a niladic function) named `char_counts`.
; = char_counts BLOCK
  # Set `i` to the input from stdin.
  ; = input PROMPT

  # Set `x` to a string of 256 `0`s. The number at each
  # index keeps track of how many times that ascii code
  # has been seen.
  ; = counts * '0' 256

  # while `input` isn't empty
  ; WHILE input
    # Set the variable `ascii_code` to the ascii codepoint
    # of the first character. If `ASCII` is given a string
    # that's more than one character long, it uses the first.
    ; = ascii_code ASCII input

    # Set the variable `new_count` to one more than the
    # previous value at `ascii_code` within `counts`. This
    # will coerce the `GET` result to an integer, which is
    # a nice added bonus.
    ; = new_count + 1 (GET counts ascii_code 1)

    # Update `counts` by replacing the character at `ascii_code`
    # (or, more precisely, the range `ascii_code..ascii_code+1`)
    # with the new, updated count.
    : = counts SET counts ascii_code 1 new_count

  # The last value of a `BLOCK` is its return value. Here,
  # we return the occurances of each byte.
  : counts

# Finally, print out whether calling `char_counts` twice
# in a row yields the same count of characters.
: OUTPUT ? (CALL char_counts) (CALL char_counts)

You put the language as C (gcc).... but the code is written in Knight.

Oh true, thanks for catching that

Just a note: this link doesn't work: https://github.com/knight-lang/knight/knight.kn (it's linked on the language page: https://github.com/knight-lang/knight-lang).

Thunno 2, 3 bytes
€Ṡạ

Attempt This Online!
Explanation
€Ṡạ  # Implicit input
€    # Apply to both strings:
 Ṡ   #  Sort the string
  ạ  # Are they both equal?
     # Implicit output

Lua, 140 chars
t={io.read():match"(%w+), (%w+)"}T=table for k=1,2 do w={t[k]:byte(1,-1)}T.sort(w)t[k]=T.concat{string.char(unpack(w))}end print(t[1]==t[2])

... like driving a screw with a light weight hammer, at least for code-golfing

Scala, 84 characters
object A{def main(a: Array[String]){println(a(0).sortWith(_<_)==a(1).sortWith(_<_))}}

This one's slightly longer, but doesn't use sorting (92 characters):
object A{def main(a:Array[String]){print((a(0)diff a(1)).isEmpty&&(a(1)diff a(0)).isEmpty)}}

You can use sorted instead of sortWith. I posted another reply with sorted as well as REPL and function versions.

@ebruchez Thanks, I'm just learning Scala at the moment and these make good exercises. :-)

Still learning myself ;)

Python 2, 79 bytes
I thought I would add a different Python approach:
import sys
for l in sys.stdin: not reduce(cmp,map(sorted,l.strip().split(',')))

Or as a function:
def f(*v): return not reduce(cmp,map(sorted,v))

Yet another Python answer :). (43 characters including whitespace)
This also includes reading in input and displaying output.
i,s=raw_input,sorted
print s(i())==s(i())

C++ Counting sort, fixed version
int a(char*x,char*y){int i=0,u[256];while(i<256)u[i++]=0;
while(*x&&*y)u[*x++]++,u[*y++]--;if(*x||*y)return 0;
for(i=255;i&&!u[i--];);return!i;}

Unrolled, so you can see what's going on:
int a(const char *x,const char *y) {
    int i=0,u[256];for(;i<256;u[i++]=0);
    for(i=0;x[i]&&y[i];i++)u[x[i]]++,u[y[i]]--;
    if(x[i]||y[i])return 0;
    for(i=0;i<256 && !u[i];i++);
    return (i==256);
}

(with due credit to Matthew Read's very elegant counting sort strategy)

Are you aware of George's userscript for this site? Very nice, but it always scores the first codeblock in an answer, so it is helpful to put the golfed version at the top.

Cheers. Edited :)

Matlab (24)
Given two strings a and b.
isequal(sort(a),sort(b))

Perl - 78 characters[1]
@x=map{join("",sort(split("")))}split(",",<>);print$x[0]eq$x[1]?"true":"false";

[1] Unlike some other Perl code above, this actually reads the input in "foo,bar" format and prints "true" or "false". Could be shorter otherwise.

Python 3 (64)
This is not a particularly good golf given how short some of the earlier Python solutions that use sorted() are, but here's a version that uses collections.Counter (an unlovable module from a golfing perspective, but with some neat stuff).  It reads two lines from input and outputs True or False.  Going with Python 3 versus 2.7 saved 4 chars with input() instead of raw_input(), but lost 1 for the parens for print since it is now a function.
from collections import *;c,i=Counter,input;print(c(i())==c(i()))

Shave one character by changing import * to import*.

I tried your challenge of not using sorted, but also avoided using collections.Counter.  Best I was able to get was 66 character.

Python 2, without sorting as that starts to get boring - 104 chars
def f(a,b):
 a,b=list(a),list(b)
 while a:
    try:b.remove(a.pop())
    except:return
 return len(a)==len(b)

Clojure - 30 chars
Too many people seem to be relying on sorting so I thought of an interesting alternative way to do this via a histogram:
#(apply = (map frequencies %))

Use this as a function, i.e.:
(#(apply = (map frequencies %)) ["boat" "toab"])
=> true

Python 3 (66)
Like jloy's answer, I eschewed using sorted because so many other answers did so.  I also didn't want to rehash his use of collections.Counter so I used str.count instead.  With these constraints I got within 3 characters of jloy.
i=input;a=i();b=i();print(all(a.count(s)==b.count(s)for s in a+b))

good use of semicolons!

k4 - 11 chars
Given strings a and b:
(a@<a)~b@<b

  a:"word"
  b:"wrdo"
  (a@<a)~b@<b
1b

At the cost of 2 chars this can be made into a function:
{(x@<x)~y@<y}["word";"wrdo"]
1b

Implementation is same as the J implementation; sort the vectors then compare equivalence.
~ is match
< is grade up (indices were the vector to be sorted ascending)
@ is index

If you take input as a list of two strings you can do slightly better: ~/{x@<x}'("baot";"boat")

Q, 25
{(~). asc each(,/)each x}

sample output:
q){(~). asc each(,/)each x}("boat";"boat")
1b
q){(~). asc each(,/)each x}("toab";"boat")
1b
q){(~). asc each(,/)each x}("oabt";"toab")
1b
q){(~). asc each(,/)each x}("a";"aa")
0b
q){(~). asc each(,/)each x}("zzz";"zzzzz")
0b
q){(~). asc each(,/)each x}("zyyyzzzzz";"yyzyzzzzz")
1b
q){(~). asc each(,/)each x}("p";"p")
1b

JavaScript, shortest JS answer so far: 57 56 characters, acccepts user input
This prompts the user for a value to compare.
function _(){return prompt().split(0).sort()+''}_()==_()

If no user input is required, this can be trimmed down to 53 52 characters.
Assuming the following variables are set:
var a='test', b='sets';

you can test for it with the following:
function _(a){return a.split(0).sort()+''}_(a)==_(b)

Note: this answer relies on some quirk that allowed using .split(0) instead of .split(""). This behavior no longer exists (at least in Firefox), so to get it running today, you have to replace 0 with "".

Bash (66 58)
f(){ fold -w1<<<$1|sort;}
g(){ [ "$(f $1)" == "$(f $2)" ];}

Call it with g <word1> <word2>.
Edit:
Stupid me, I do not need to unic -c after I sort

FYI: TIO link with working code. $? emits 0 if the inputs are anagrams (truthy), 1 if not.

Python - 137 chars
def h(s):
    r={}
    for c in s:
        try:r[c]+=1
        except:r[c]=1
    return r
x=raw_input().split(',')
print h(x[0])==h(x[1])

Sample: (I defined a function anagram to do the work of the last 2 lines.)
   anagram('boat','boat')
True
    anagram('toab','boat')
True
    anagram('oabt','toab')
True
    anagram('a','aa')
False
    anagram('zzz','zzzzzzzz')
False
    anagram('zyyyzzzz','yyzzzzzy')
True
    anagram('sleepy','pyels')
False
    anagram('p','p')
True

Groovy 42
def f(a,b){print ((b as Set)==(a as Set))}

Pyth - 8 7 6
MqSGSH

Defines function with two args, the two words.
M       define function g with two args, G and H
 q       equals
  SQ     sorted first arg
  SH     sorted last arg

If that cheating golfscript program counts with hardcoded input, we can do that too with : qSS
And for just two more characters you can have it check an infinite number of words:
ql{mSdQ1

q    1       Equals 1
 l           Length
  {          Set constructor (eliminate all duplicates)
   m  Q      Map on evaluated input
    Sd       Sort each element

How would qSS work? I am trying to learn pyth and I am curious.

@ericmark26 its the same as the golfscript and its cheating because it need hardcoding. qss just means equals, sort, sort. You'll have to put the strings after the S's

C - 107 chars
Mark off chars in second string as we go. At the end, if we've passed over the entirety of both strings, then we've got a match.
i;main(p,v)char**v,*p;{for(;*v[1]&(p=strchr(v[2],*v[1]++));)*p=1,i++;puts(*(v[2]+i)|*v[1]?"false":"true");}

PowerShell, 78 51 bytes
param([char[]]$a,[char[]]$b)(diff $a $b).Length-eq0

Takes the two string inputs, and re-casts them as char-arrays. The diff function (an alias for Compare-Object) takes the two arrays and returns items that are different between the two. We leverage that by re-casting the return as an array with (), and then checking its length. If the length is zero, that means that all items of both character arrays are exactly the same (because nothing was returned). PowerShell has an implicit write for evaluated statements like this, so will automatically write out True or False as required.

C, (108)
char c[192]={};main(){for(;*a;c[127-*a++]++);for(;*b;c[223-*b++]++);puts(memcmp(c,c+96,95)?"false":"true");}

Q, 15 Bytes
f:{~/{x@<x}'x}

f is the name of the function
Test
f("boat";"boat")            /1b
f("toab";"boat")            /1b
f("oabt";"toab")            /1b
f(,"a";"aa")                /0b
f("zzz";"zzzzzzzz")         /0b
f("zyyyzzzz";"yyzzzzzy")    /1b
f("sleepy";"pyels")         /0b
f(,"p";,"p")                /1b

Explanation
Argument of the function is a sequence with both words. At each word applies {x@<x}, that sorts x (take from x in ascending index ordering). ~/ reads as "match over", and compares both transformed words

If you're using k rather than Q you can just do ~/x@'<:'x: for 10 bytes. No need to create the outer function f nor the inner function if you set x to be the input.

Retina, 10 bytes
This answer is non-competing since Retina is much newer than this challenge. Byte count assumes ISO 8859-1 encoding.
%O`.
D`
¶$

Input is linefeed-separated.
Try it online!
Explanation
%O`.

This sorts (O) the individual characters (.) in each line (%), i.e. it sorts each input string separately.
D`

This deduplicates the input on the (implicit) regex .*, which means it removes the characters from the second line if both strings are equal.
¶$

Finally, this tries to match a linefeed followed by the end of the string. Since the input strings are guaranteed to be non-empty, this can only happen if the second string was removed in the previous stage.

C++14, 104 bytes
As generic function returning via reference parameter. Accepts char[] or std::string or any other container that supports range-based for loop.
Returns 0 for anagram, anything else for non-anagram
#define F(X) for(auto x:X)
void f(auto&A,auto&B,int&r){int C[256]={r=0};F(A)C[x]++;F(B)C[x]--;F(C)r|=x;}

Ungolfed and usage:
#include<iostream>

#define F(X) for(auto x:X)

void f(auto&A,auto&B,int&r){
  int C[256]={r=0}; //declare counting array and set return value to 0
  F(A)C[x]++;       //increase first string chars
  F(B)C[x]--;       //decrease second string chars
  F(C)r|=x;         //if any char is not zero
}

int main(){
  int r;
  #define P(a,b) f(a,b,r); std::cout << a << ", " << b << " -> " << r << "\n"
  P("hello","wrong");
  P("hello","olleh");
  P("zz","zzzzzz");
}

Jelly, 3 bytes (probably non-competing)
Ṣ€E

Try it online!
Similar to X88B88's solution, but this takes a list of strings instead of two arguments, like ["String1", "String2"].
Explanation:
Ṣ€      Sort each input
  E     Check equality

Mathematica 28 Bytes
Split into list of characters, sort and test for equality.
Equal@@ Sort/@Characters[#]&

Usage
%@{"BOAT", "TOAB"}

Output
True

Japt, 10 9 5 4 bytes
á øV

Try it
á øV     :Implicit input of strings U & V
á        :Permutations of U
  øV     :Contains V?

As of v2.0a0, ¬n eV¬n works with 7 bytes.

øVá

Wolfram Language 26 bytes ( Mathematica )
ContainsAll@@Characters@#&

Usage:
%@{"BOAT","TOAB"}

Output:

True

Common Lisp, 50 bytes
(lambda(a b)(string=(sort a'char<)(sort b'char<)))

Try it online!

Perl 5, 27 + 3 (-lF) = 30 bytes
@{$.}=sort@F}{say"@1"eq"@2"

Try it online!

The -l option is not needed. It would still count as +3 though since you must count the space too (since you cannot bundle the -F with -E. You can however do the final match using @1~~@2 saving 4 bytes (or 3 if you add an extra X option letter to supress the warning). Very neat solution by the way. Have a +1

SmileBASIC, 49 bytes
INPUT A$,B$WHILE""<A$B$[INSTR(B$,POP(A$))]="
WEND

Throws an error when the strings aren't anagrams.

Symja, 26 bytes
f(x_,y_):=Sort(x)==Sort(y)

Try It Online!
Try With Changeable Tests
Assumes strings are given as a list of characters.

05AB1E, 3 bytes
Aargh! I can't beat GolfScript!
œså

Try it online!
Explanation
œ   All permutations of the first input
 så Do the permutations contain the second input?

œQà
œ   All permutations
 Q  Equality with input
  à Maximum

€{Ë
€{  Map sort over the input list
  Ë Are all items equal?

Julia, 26 bytes
!a=sort([a...])
a\b=!a==!b

Try it online!

TI-Basic, 83 bytes
Prompt Str1,Str2
"seq(inString(Str1+Str2,sub(Ans,I,1)),I,1,length(Ans→u
Str1
u→A
SortA(ʟA
Str2
u→B
SortA(ʟB
0
If dim(ʟA)=dim(ʟB
min(ʟA=ʟB
Ans

Output is stored in Ans and displayed. Outputs 1 if the inputs are anagrams, otherwise 0.

Alice, 11 bytes
/@Mn/
\MOX\

Try it online!
Prints Jabberwocky if the two words are anagrams
Flattened
MM       Reads the two arguments
  X      Compute their symmetric difference
   n     Empty string becomes Jabberwocky, anything else becomes empty string
    O    Print it out
     @   Bye

R, 47 bytes
\(x,y)all(table(strsplit(paste0(x,y),""))%%2==0)

Fails for aab + bcc: try it.

BQN, 3 bytes
≡○∧

Anonymous tacit function that takes two strings; returns 1 if they are anagrams, 0 otherwise. Try it at BQN online!
Explanation
≡    Are the strings identical
 ○   when both of them
  ∧  are sorted?

J-uby, 17 bytes
:*&(A|:sort)|+:==

Attempt This Online!
Explanation
:* & (A | :sort) | +:==

:* & (         )         # Map with...
      A | :sort          #   convert to character array, then sort
                 | +:==  # then compare

Nekomata + -e, 2 bytes
↕=

Attempt This Online!
↕       Check if any permutation of the first string
 =      is equal to the second string

Perl, 60 bytes
Perl one-liner
perl -lanF -e 'push@a,join"",sort@F;END{exit($a[0]ne$a[1])}'

Takes first two lines of STDIN and compares them. Exits 0 if they're anagrams, 1 otherwise.
$ echo -e "word\nwrdo" | \
> perl -lanF -e 'push@a,join"",sort@F;END{exit($a[0]ne$a[1])}' && echo anagram
anagram
$ echo -e "word\nwrro" | \
> perl -lanF -e 'push@a,join"",sort@F;END{exit($a[0]ne$a[1])}' && echo anagram
$

C#
bool IsJumbledPair(string a, string b) {
   if(a.Length!=b.Length) return false;
   foreach(char c in a.ToCharArray()) {
      int i = b.IndexOf(c);
      if(i<0) return false;
      b = b.Remove(i,1)
   }
   return (b.Length==0);
}

Readable, and does not require sorting.
Another method:
bool IsJumbledPair(string a, string b) {
   string c;
   while {
     if(a.Length!=b.Length) return false;
     if(a.Length==0) return true;
     c = a.Chars(0).ToString();
     b = b.Replace(c, "");
     a = a.Replace(c, "");
   }
}

The above version works better when the strings contain a number of duplicated characters, as each distinct character is only compared once using the relatively fast Replace() method.
VB.NET
Same as the first C# example, slightly simpler using Replace() method, but doesn't short-cut like the C# version:
Function IsJumbledPair(a As String, b As String) As Boolean
   If a.Length <> b.Length Then Return false
   For Each(c As Char In a.ToCharArray())
      b = Replace(b, c.ToString(), "", 1, 1)
   Next
   Return (b.Length=0)
}

It is likely that the downvotes are because you have made no effort to golf (see the tag?) your solutions, or because you have mixed several distinct solutions in one answer.

Meh. If I play real golf, it's for socializing or beer, not score-keeping. Guess I should have actually been playing to win... :)

People generally respond well to solutions in wordy languages (I play in Fortran 77 from time to time), as long as you make an effort to write aggressively compacted , and especially if your languages supports a interesting trick (i.e. fortran has computed branches).

PHP (51 chars, compressed)
function d($s){$s=str_split($s);sort($s);return$s;}

(Split string into an array, sort the array and return)
Example:
var_dump(d("word")===d("drow"));

Ruby (35)
a,b=ARGV;a.chars.sort==b.chars.sort

(Five years later...) $* is a handy alias for ARGV for 2 bytes.

C# 118 chars
using System.Linq;namespace A{class P{static void Main(string[] a){System.Console.Write(!a[0].Except(a[1]).Any());}}}

Readable:
using System.Linq;

namespace A
{
    class P
    {
        static void Main(string[] a)
        {
            System.Console.Write(!a[0].Except(a[1]).Any());
        }
    }
}

You can remove an extra character: string[]a
You also don't need a namespace.

Groovy, 54
print args[0].toList().sort()==args[1].toList().sort()

I've fixed up the formatting for you. Stack Exchange site use MarkDown (though they do accept a subset of html). THe sidebar on the edit page has some hints, the edit toolbar has common operations, and there is a detailed help page.

F# (59 chars)
let f a b=(Seq.sort>>Seq.toArray)a=(Seq.sort>>Seq.toArray)b

Very annyoying that sequences can' be directly compared.

C - 79 90 chars (using strchr & strlen)
r(char*s,char*t){int i=0;for(;*s&&strchr(t,*s++);i++);return i==strlen(t)?1:0;}

Ungolfed...
r( char *s, char *t )
{
    int i=0;
    for (; *s && strchr(t, *s++); i++)
        ;
    return i == strlen(t) ? 1 : 0;
}

C - 115 110 chars (brute with histogram)
int k,u[256];ρ(char*s,char*t){char*v=s;for(;*s;)u[*s++]++;for(;*t;)u[*t++]--;while(*v&&!(k=u[*v++]));return k?0:1;}

Ungolfed...
int k, u[256];
r(char *s, char*t)
{
    char *v = s;

    for (;*s;)
        u[*s++]++;
    for (;*t;)
        u[*t++]--;

    while(*v && !(k=u[*v++]) )
        ;
    return k ? 0 : 1;
}

EDIT: fixed bug in brute version.
EDIT: added brute version (no library functions).

You use the table 256 char; if you call that function more that one time it is necessary make that 256 table 0.

Python 121 Characters
It's not a winner wrt length, but I didn't use sorted!
from sys import argv as s
for i in s[1]+s[2]:
 if not s[1].count(i)==s[2].count(i):
  print 'False'
  break
else:
 print 'True'

You can save 2 characters by changing the import to from sys import* (newline) s=argv.

Algorithm fails with s[1]='the',s[2]='them'.

You could avoid the need to dereference s by from sys import* (newline) _,a,b=argv.

Ada 2005 - 314 218
type V is array(Character)of Natural;function A(L,R:String)return Boolean is
C,D:V:=(others=>0);begin
for I in L'Range loop
C(L(I)):=C(L(I))+1;end loop;for I in R'Range loop
D(R(I)):=D(R(I))+1;end loop;return C=D;end;

Coffee Script (52)
a=(b,c)->`b.split('').sort()==c.split('').sort()+''`

usage
console.log a 'god', 'dog'

Groovy, 46
b={args[it].toList().sort()}
print b(0)==b(1)

Java, 173 chars
import java.util.*;class C{public static void main(String[]a){byte[]d,f;Arrays.sort(d=a[0].getBytes());Arrays.sort(f=a[1].getBytes());System.out.print(Arrays.equals(f,d));}}

It's the same that Guus one  but changing a couple of methods.

So it's no shorter but it is buggier?

Hmmm... Why buggier?

Maybe this? "The behavior of this method when this string cannot be encoded in the default charset is unspecified." :P

My bad, forgot to check the spec. I was thinking about characters in the range \u0080 to the end of the BMP, which become more than one byte, and which would allow collisions.

CoffeeScript 129
Longer than the other CoffeeScript entry, but this one uses recursive string comparison, rather than just comparing sorted strings:
z=(x,y)->d=y.length;e=x.length;return 1if(!d&&!e);b=y.indexOf x[0];return 0if b<0;f=x[1..e];g=y[b+1..d];g=y[0..b-1]+g if b;z(f,g)

Outputs 1 or 0 indicating whether the strings are anagrams or not.

Javascript 70 (with primitive GUI)
Here's a Javascript entry that also includes a primitive GUI via two prompts and an alert.
function a(){return prompt('').split('').sort().join()}alert(a()==a())

Have a play – http://jsfiddle.net/liamnewmarch/jGues/

JavaScript 87
alert((a=prompt().split(","))[0].split("").sort().join()==a[1].split("").sort().join())
Prompt requires comma separated list of two "words"
[Prompt]
btoa,boat
Output: true

import java.util.Scanner;
public class Match
{
    public static void main(String[] args)
    {
        Scanner s=new Scanner(System.in);
        String s1=s.nextLine();
        String s2=s1.toLowerCase();
        char []a=s2.toCharArray();
        String s3=s.nextLine();
        String s4=s3.toLowerCase();
        char []e=s4.toCharArray();
        int h,g = 0,l=0,r=0,h1=0,m=0;
        int b=(int)a[0];
        int f=(int)e[0];
        //System.out.println();
        for(int k=0;k<a.length;k++)
        {
            for(h=1+k;h<a.length;h++)
            {
                if(b>(int)a[h])
                {
                    b=a[h];
                    char temp=a[h];
                    a[h]=a[k];
                    a[k]=temp;
                }

            }
        if(l<a.length-1)
        {
                b=a[++l];
        }
        }
        for(int k1=0;k1<e.length;k1++)
        {
            for(h1=1+k1;h1<e.length;h1++)
            {
                if(f>(int)e[h1])
                {
                    f=e[h1];
                    char temp=e[h1];
                    e[h1]=e[k1];
                    e[k1]=temp;
                }

            }
        if(m<e.length-1)
        {
            f=e[++m];
        }
        }
        if(a.length==e.length)
        {
            int flag=0;
            for(int j=0;j<a.length;j++)
            {
                if(a[j]==e[j])
                {
                    flag++;
                }
            }
            if(flag==e.length)
            {
                System.out.println("True");
            }
            else
            {
                System.out.println("false");
            }
        }
        else
        {
            System.out.println("False");
        }
    }
}

C#, 144 chars
namespace System.Linq{class m{static void Main(string[]a){Console.Write(a[0].Select(t=>a[1].Select(y=>t!=y)).Count()*2==(a[0]+a[1]).Length);}}}

Function: 90 chars
bool i(string a,string b){return a.Select(t=>b.Select(y=>t!=y)).Count()*2==(a+b).Length;}

VB.net
Module Q
Sub Main(a As String())
 Console.WriteLine(a(0).Count=-a(0).Sum(Function(c)a(1).Sum(function(x)x=c)))
End Sub
End Module

C 138
Code finds the sum of the differences of the characters then checks if they are same length and sum == 0.
int s,t,i,j;
void f(char*a,char*b)
{
while (*a&&*b){
s+=*a-*b;
a++;b++;
i++;j++;
}
if (i==j&&s==0)t=1;
puts(t?"true":"false");
}

This can not be ok every input... What about string has the same value example "caa" and "bba" ?

Groovy 44
def f(a,b){print !(a-b)&&a.size()==b.size()}

Python, 20 bytes
lose to golfscript again...... :(
sorted(x)==sorted(y)

This will work, but it does not include the parsing of x and y, which can contribute to the length of the answer.

pure bash 136
There is a method without sorting step!
anagramCmp() {
    x=0 y=0
    for((i=0;i<${#1};i++));do
        ((x+=7**(36#${1:i:1}-10)))
        ((y+=7**(36#${2:i:1}-10)))2>/dev/null
    done
    return $((${#1}$x==${#2}$y?0:1))
}

Then now:
if anagramCmp Blah Halb ; then echo Yo; else echo Uh; fi
Yo

if anagramCmp Blahblah Hhaallab ; then echo Yo; else echo Uh; fi
Uh

Javascript - 57 chars
function o(a,b){return b?o(a)==o(b):1+a.split("").sort()}

Your function will fail if in the first try, b was empty.

All inputs will be at least 1 char long, you give the function the 2 strings you want to compare so that won't happen

@Optimizer did you even try running it?

Ah, I see. In that case, it will be fine.

Pyth - 19
qS@cz", "0S@cz", "1

Try it here. Note that the two words in the input must be separated by a comma and a space.
Python Mapping and explanation
q                     #      equal(              "Check equality"
 S                    #      sorted(             "Sort"
  @                   #      list looku          "Extract element from list"
   c                  #      chop(               "Separate by delimiter"
    z                 #      input(              "Input variable"
     ", "             #      ", "                "This delimiter"
         0            #      0                   "The 0th element"
          S@cz", "1   #      ..                  "The same thing with the 1st element

I'm sure someone can come up with a shorter implementation, but I've only been learning Pyth for a few days. It would also be a lot shorter if I didn't stick strictly to the input format given in the question.
For instance:
qS@Q0S@Q1
Which is only 9 bytes, works if the input is formatted like 'parse','spare'. So which one  do you count?
Good practice though!

Ruby, 32
h=->{gets.chars.sort}
p h[]==h[]

Javascript, 143 119 bytes
a=prompt()[s="split"](" ");a[0]=a[0][s]("");a[1]=a[1][s]("");a[0].sort();a[1].sort();alert(a[0][j="join"]()==a[1][j]())

Takes a single space-seperated pair of strings as input.

rs, 35 bytes
+(.)(.*) (.*)\1/\2 \3
\s/
.+/0
^$/1

Yay regexes!!
BTW, rs was created way after this was posted, so this technically doesn't count. Still cool.
Live demo and all test cases.

R, 63 Bytes
length(unique(lapply(strsplit(c(s,m),''),sort))[[1]])==nchar(m)

It seens it passes the test cases.
(just realized this question is 4 year old, but posting anyway)

Passing the test cases does not necessary make a working function. Your function only works when the number of unique characters in s is equal to the number of characters in m. For instance, s="boatee" and m="toobee" yields TRUE, when it should actually be FALSE.

Javascript (ES6) 35
Requires lambdas
Just like the other solutions, but with lambda
f=x=>x.split``.sort()
f(a)==f(b)+""

Usage
// a, b = input
f=x=>x.split``.sort()
console.log(f(a)==f(b)+"")

thanks @comment

Welcome to PPCG! Since you're using ES6, you could replace split('')... with split``... to save two bytes.

You can also shave off 3 bytes by replacing x.split\`with[...x]`

Powershell 48 bytes
param([char[]]$a,[char[]]$b)![bool](diff $a $b)

Cast incoming strings as an array of char.  Use diff (compare-object) on the two objects and cast as bool.  Since a blank result (diff only shows differences not similarities) is False, negating it with ! will result in true for identical strings.
Added benefit: it will work on any arbitrary length strings (if equal whitespace).

Pyke, 4 bytes
mSXq

Try it here!
Also 4 bytes
SRSq

Try it here!

Jelly, 5 Bytes (Non-competitive)
Ṣ⁼⁴Ṣ¤

Special thanks to Leaky Nun for helping me fix a problem.
Outputs one if true.
Try it Online!

R, 69 bytes
a=function(b,d)identical(table(strsplit(b,"")),table(strsplit(d,"")))

I think this is the shortest R implementation which deals with a("b","bb") being FALSE.

Racket 92 bytes
(λ(a b)(define(g s)(sort(map(λ(x)(char->integer x))(string->list s))>))(equal?(g a)(g b)))

Ungolfed:
(define f
  (λ (a b)
    (define (g s)    ; fn to get sorted list of string chars as numbers.
      (sort
       (map
        (λ(x)(char->integer x))
        (string->list s))
       >))
    (equal? (g a) (g b))))

Testing:
(f "test" "ttse")
(f "boat" "boat")
(f "toab" "boat")
(f "oabt" "toab")
(f "zyyyzzzz" "yyzzzzzy")
(f "a" "aa")
(f "zzz" "zzzzzzzz")
(f "sleepy" "pyels")

Output:
#t
#t
#t
#t
#t
#f
#f
#f

Scala - 64 Bytes
Could be made shorter (the toList could be changed to toSeq, I believe)
('a'to'z').forall(c=>y.toList.count(_==c)==z.toList.count(_==c))

C 110 bytes
char*a,*b;l(i,j,k){y:if(!b[j]||!a[i])return i==k+1;if(a[i]==b[j]){b[j]=1;return l(i+1,0,j>k?j:k);}++j;goto y;}

this is one recursive function that has one not common way to have its input and
write in one its argument... but not use library functions....
/*
l(i,j,k)
{y: if(!b[j]||!a[i])return i==k+1;
    if(a[i]==b[j]){b[j]=1;return l(i+1,0,j>k?j:k);}
    ++j;goto y;
}
//110
r=1 m1=12345  m2=?????
r=0 m3=a  m4=e
*/

main()
{char m1[]="12345", m2[]="54321", m3[]="a", m4[]="e";
 int  r;

 a=m1;b=m2;r=l(0,0,0);printf("r=%d m1=%s  m2=%s\n", r, m1, m2);
 a=m3;b=m4;r=l(0,0,0);printf("r=%d m3=%s  m4=%s\n", r, m3, m4);
}

Please do not vandalize your posts.

C 87 bytes
char*a,*b,*c;d(i,k){return!a[i]||!(c=strchr(b,a[i]))?i==k+1:(*c=1,d(i+1,k<c-b?c-b:k));}

this is one recursive function that has one not common way to have its input and write in one its argument...this use recursion + library function...
/*
char*a,*b,*c;
d(i,k)
{return !a[i]||!(c=strchr(b,a[i]))?i==k+1:(*c=1,d(i+1,k<c-b?c-b:k));}
87
*/

 main()
{char m1[]="12345", m2[]="54321", m3[]="a", m4[]="e";
 int  r;

 a=m1;b=m2;r=d(0,0);printf("r=%d m1=%s  m2=%s\n", r, m1, m2);
 a=m3;b=m4;r=d(0,0);printf("r=%d m3=%s  m4=%s\n", r, m3, m4);
}

How it is possible 20 min ago I not remember a C solution less than 109 bytes, now I read C solutions less bytes than 80 bytes edited in 2011...

awk, 63 65 bytes
It only accepts chars a-z (0141-0172). gsub counts occurrances of each char in alphabet, appends them to a variable (variable looks something like 140213000000000000..., starts with 140 for initialization) and compares frequencies in variables in the end. It returns the value of the comparison on exit:
{for(a=i=140;++i<173;)a=a gsub("\\"i,1);if(p>1)exit(p==a);p=a}

Test it:
$ cat file
aabccc
abcacc
$ awk '{for(a=i=140;++i<173;)a=a gsub("\\"i,"");if(p>1)exit(p==a);p=a}' file
$ echo $?  # will output 0 or 1 where 1=true and 0=false
1

APL (Dyalog), 10 bytes
≡/(⊂∘⍋⌷⊢)¨

Try it online!
The program takes in two strings in a single array as its right argument.
Explanation
¨            For each string
 (⊂∘⍋⌷⊢)      Sort it
≡/           And check if both strings are equal

Excel VBA, 87 Bytes
Anonymous VBE immediate window function that takes input from range A1:B1 and outputs whether the two inputs are anagrams of one another to the VBE immediate window. This a destructive process as the value inputted into range B1 is destroyed
For i=1To[Len(A1)]:[B1]=Replace([B1],Mid([A1],i,1),"|",,1):Next:?[B1=Rept("|",len(A1))]

J, 8 bytes
-:&(/:~)

Match -: after sorting /:~ both args &.
Try it online!

Axiom, 45 bytes
f(a:String,b:String):Boolean==sort(a)=sort(b)

Julia, 41 bytes
g(a,b)=sort(collect(a))==sort(collect(b))

Python, 99 chars
f=lambda w,x,y:w==y if x==""else any([f(w+a,x.replace(a,"",1),y)for a in x])
g=lambda x,y:f("",x,y)

Try it Online!
Recursively finds all permutations of x and compares them to y.

Tcl, 82 bytes
proc A x\ y {expr {[string le $x]==[string le $y]&[lsort -u [split $x $y]]=="{}"}}

Try it online!

Tcl, 83 bytes
proc A x\ y {expr {[string le $x]==[string le $y]&&[lsort -u [split $x $y]]=="{}"}}

Try it online!

Tcl, 84 bytes
proc S s {lsort [split $s ""]}
proc A x\ y {set x [S $x]
set y [S $y]
expr {$x==$y}}

Try it online!
Previous version was failing for comparing 2 to 20, because after the lsort and join the comparison became 2==02, and == was doing a numerical comparison instead of a numerical one!

Tcl, 94 bytes
proc S s {join [lsort [split $s ""]] ""}
proc A x\ y {set x [S $x]
set y [S $y]
expr {$x==$y}}

Try it online!

Pyth, 4 bytes
_ISM

Try it Online
Explanation
_ISM
  SMQ   Sort both (implicit) inputs.
_I      Check if the result is invariant under reversing.

Perl, 26 bytes
Includes +1 for p (using -F and @F ends up with the same score)
Give the input strings as 2 lines on STDIN.
(echo word; echo wrdo) | perl -pE '$\=${join W,sort/./g}++}{'

This prints 0 if not an anagram or 1 if it is an anagram
(echo word; echo wrdo) | perl -pE '$_=${join W,sort/./g}++'

comes in at 24 bytes and prints 00 if not an anagram and 01 if it is. If these values are numbers they are in fact valid falsy and thruthy in perl, but as strings they are both thruthy. It's probably fairer to consider them as strings so this solution is invalid
So this is the same length (but without warnings) as Xcali's answer (after optimizing):
(echo word; echo wrdo) | perl -F -E '@{$.}=sort@F}{say@1~~@2'

MathGolf, 4 bytes
ms~=

Try it online!
Explanation
m      explicit map
 s     sort(array)
  ~    dump array to stack
   =   pop(a, b), push(a==b)

Pepe, 58 bytes
REEREEEEeEERREEeREEEEeEeErRREEEEEeEEreerrEEREEeeReEErEereE

Try it online! Input is in the form a;b. Outputs 0 for truthy and none for falsy.

Pushy, 13 bytes
Assumes the two inputs are separated by a space.
K32-$v;.gFgx#

Try it online!
                 \ Implicit: input on stack as character codes
K32-             \ Subtract 32 from all, making SPACE = 0
    $            \ Until 0 (space) on top of stack:
     v;          \   Send last char to auxiliary stack
       .         \ Space has been reached, pop it.
                 \ Now each stack contains all the letters of one of the words.
        gFg      \ Sort both stacks
           x     \ Check their equality
            #    \ Print result (1 if true, 0 if false)

C# (.NET Core), 108 bytes
Without LINQ.  Returns 1 for true, 0 for false.
(a,b)=>{int x=a.Length==b.Length?1:0;foreach(char c in a){try{b.Remove(b.IndexOf(c));}catch{x=0;}}return x;}

Try it online!

Lua 112
function q(a,b)s=table.sort;t=table.concat;a={a:byte(1,#a)}s(a);b={b:byte(1,#b)}s(b)return t(a,".")==t(b,".")end

Java 16, 85 bytes
a->b->a.chars().sorted().boxed().toList().equals(b.chars().sorted().boxed().toList())

Java 16 added the Stream#toList method.
Java 8, 88 bytes
a->b->java.util.Arrays.equals(a.chars().sorted().toArray(),b.chars().sorted().toArray())

Try it online!

Ly, 46 29 bytes
iayr>iay&s<l[0I=![0u;]pprp]1u

Try it online!
I know Ly better now. :)  At a high level, this code constructs two stacks, each with a sorted (by codepoint) list of characters in the associated input string, with the length of the string included as another entry on the list.
One stack is reversed and then the two are concatenated.  Once that setup is done, the code loops comparing the top and bottom of the stack.  The first time the codepoints aren't the same, the code write out a 0 and exits.  If the loop exhausts the stack, the strings are anagrams so the code writes out a 1 and exits.
It's still nowhere near the shortest, but the way it works might be interesting to people?
 # parse the first string
 i                             - read in one line
  a                            - sort by codepoint value
   y                           - push the stack length
    r                          - reverse the stack
  # parse the second string
     >                         - switch to a new stack
      i                        - read in one line
       a                       - sort by coidepoint
        y                      - push the stack length
         &s                    - stash the entire stack
 # setup for processing
           <                   - back to stack with string 1
            l                  - append the parsed second string
 # compare pairs of codepoints while stack isn't empty
             [             ]   - loop, process one char per iteration
              0I               - copy bottom of stack
                =!             - compare top two negate
                  [   ]p       - if/then, if they don't match
                   0u;         - print "0" and exit
                        prp    - delete pair we just checked
 # if lengths and all the codepoints matched...
                            1u - success! print "1"

PHP7.4 (45 chars)
The function $f will return the answer using count_chars :
$f=fn($a,$b)=>($x='count_chars')($a)==$x($b);

Try it Online - in PHP4 the XOR cipher passes all tests using 48 chars :
function f($a,$b){return$a==chop($a.$b^$b^$b);};

C gcc (69 chars)
The function f compute the product of  both string and implicitly return the comparison :
i;j;f(char*a,char*b){i=j=1;for(;*a;i*=*a++);for(;*b;j*=*b++);a=i==j;}

Try it Online
C version isn't shaved up to 65 chars by XOR cipher due to some ae == bf misses :
i;f(char*a,char*b){i=1;for(;*a;i^=*a++);for(;*b;i^=*b++);a=i==1;}

You can put the $f= into the header, as as long as the function does not reference itself, you can drop the function name from the char count. like this

also you can remove the quotes around count_chars. it will spout all sorts of stuff to stderr, but who cares

68 bytes

Factor + math.combinatorics, 22 bytes
[ <permutations> in? ]

Try it online!
Is the first input in the permutations of the second input? Not the fastest, but shorter than sorting or counting.

C - 115 Bytes
a[127],b[127],i,o=1;f(char*s,char*z){for(;*s;a[*s++]++);for(;*z;b[*z++]++);for(;i++<128&&o;o=a[i]==b[i]);return o;}

Ungolfed
a[127], b[127], i, o = 1;

f(char* s, char* z)
{
    for(; *s; a[*s++]++);
    for(; *z; b[*z++]++);
    for(; i++ < 128 && o; o = a[i] == b[i]);

    return o;
}

Alternative way (By @ceilingcat)
*a,*b,i,o;f(char*s,char*z){for(a=calloc(i=128,8);*s;a[*s++]++);for(b=a+i;*z;b[*z++]++);for(;i--&&(o=a[i]==b[i]););return o;}

Explanation
A function that receives two ASCII character strings with arbitrary length and checks if one is an anagram of the other.
To accomplish this, both entire strings are iterated over and the number of matches for each character is stored in a list for each string;  later it is checked if both lists have the same number of matches, if so, then the strings are anagrams and true (1) is returned, otherwise false (0) is returned.

Fixed some bugs 124 bytes

@ceilingcat thanks for your comments.

Ruby, 46 bytes
I hope there's a way better than this.
p gets.strip.chars.sort==gets.strip.chars.sort
Attempt This Online!

a lambda taking two args would be shorter

38

Raku, 22 bytes
{[~~] @_».comb».Bag}

Try it online!

.comb converts each input string to a list of its characters.
.Bag converts each list of characters into a Bag object (a set with multiplicity).
[~~] inserts the ~~ smartmatch operator between the two Bags, which returns true if and only if they have the same contents.

Zsh, 43 bytes
Try it Online!
<<<${${(j::)${(os::)1}}/${(j::)${(os::)2}}}

Truthy: empty string (i.e. the inputs are anagrams). Falsy: a string of characters. Link goes to a test harness where Truthy is printed as T, Falsy as F.

Labyrinth, 23 bytes
1
,:#
* 0
1;/----+}=-!@

Try it online!
Takes two words separated by a newline. For each word, computes the product of c * 10 + 1 for each char c, and compares the two values. Prints 0 for true and a nonzero integer for false.
Such product is unique for lowercase words up to permutation, since the counts of 25 out of 26 letters can be recovered from the exponents of 25 unique prime factors:
971 is prime
981 = 109 * 3 * 3
991 is prime
1001 = 7 * 11 * 13 (no unique prime factor)
1011 = 337 * 3
1021 is prime
1031 is prime
1041 = 347 * 3
1051 is prime
1061 is prime
1071 = 17 * 7 * 3 * 3
1081 = 47 * 23
1091 is prime
1101 = 367 * 3
1111 = 101 * 11
1121 = 59 * 19
1131 = 29 * 13 * 3
1141 = 163 * 7
1151 is prime
1161 = 43 * 3 * 3 * 3
1171 is prime
1181 is prime
1191 = 397 * 3
1201 is prime
1211 = 173 * 7
1221 = 37 * 11 * 3

Therefore this approach works for arbitrary length inputs.
Since a lowercase letter has value of 97 or higher, the newline has value 10, and -1 is pushed on EOF, a three-way branch is possible via dividing the input value by any number between 11 and 97 inclusive.
By a little bit of planetary alignment, letting the IP reflect on newline (instead of creating a 4-way junction) magically sets up the stack for the second word. This part works because the words are guaranteed to be nonempty.
1    push 1 on empty stack

,:#  loop: compute the value of word1 until newline
* 0    ,:   getchar, dup  [word1 c c]
1;/    #0/  divide by 30  [word1 c c/30]
       if positive:
         ;1*  drop, multiply 10c+1  [word1']
       if zero: reflect

1    [word1 10 0]
,:#  0#:  push some garbage [word1 10 0 3 3]
  0  ,    getchar (1st char of word2)
     1    times 10 plus 1
     [word1 10 0 3 3 word2]
     enter the loop again to compute the value of word2
     same flow as first loop, except that # gives 8 and
     IP turns left on EOF
     [word1 10 0 3 3 word2 -1 -1]
----+}=-!@  clean up the stack and compare word1 and word2
     ----+ [word1 10 word2]
     }=    [word1 word2 | 10]
     -!@   print the difference and halt

APL(NARS), 5 chars
≢⎕§⍦⎕

It return 0 if the two string are anagram each of other, or one number different
of 0 otherwise. Test & how to use:
      ≢⎕§⍦⎕
⎕:
      '123'
⎕:
      '312'
0
      ≢⎕§⍦⎕
⎕:
      '123'
⎕:
      '2143'

1

YASEPL, 77 bytes
=1'=2'=c=e®1=f®2`1!g¥c,1=d=i`2!h¥d,2}7,g,3!i$`3!d+}2,f,2!i]4!c+}2,e>1|5`4>0`5

prompts you twice for both words, outputs either a one or zero for if its true or false respectively

Swift 5.9, 30 bytes
let f={Set($0+"")==Set($1+"")}

The obvious method. Initializes unordered Sets from the inputs (after concatenating empty strings to assist the type checker) and compares them.


text:
Turn 2D boolean array into (rectilinear) polygons
Challenge
Write a program which, given a 2-dimensional boolean array (equivalently, a monochromatic bitmap), outputs a series of polygons that describe the outline of the region that is “true” (1).
The input is provided as a sequence of '#' (hash), ' ' (space) and \n (newline) characters. Lines may differ in length, in which case the missing parts are assumed to be spaces. The output should be a (newline-separated) list of polygons, each polygon represented by a (comma-separated) list of coordinates.
Examples & Requirements

The co-ordinates must be listed in clockwise order. Input:
#

Acceptable outputs include:
(0,0), (1,0), (1,1), (0,1)

(1,0), (1,1), (0,1), (0,0)

(1,1), (0,1), (0,0), (1,0)

(0,1), (0,0), (1,0), (1,1)

Disjoint regions must return multiple polygons. Input:
# #

Example output (actual output must consist of two lines):
(0,0), (1,0), (1,1), (0,1)
(2,0), (3,0), (3,1), (2,1)

Holes in a polygon must be listed as a separate polygon, but in anti-clockwise order. Input:
###
# #
###

Example output:
(0,0), (3,0), (3,3), (0,3)
(1,1), (1,2), (2,2), (2,1)

You are free to choose whether diagonally adjacent vertices join up or not. Input:
#
 #

Example output:
(0,0), (1,0), (1,1), (0,1)
(1,1), (2,1), (2,2), (1,2)

or
(0,0), (1,0), (1,1), (2,1), (2,2), (1,2), (1,1), (0, 1)

The lists of coordinates need not be optimally short. For example:
##

Acceptable outputs:
(0,0), (2,0), (2,1), (0,1)

// Redundant coordinates along a straight line are acceptable
(0,0), (1,0), (2,0), (2,1), (1,1), (0,1)

// Duplicate start- and end-point are acceptable
(0,0), (2,0), (2,1), (0,1), (0,0)

As usual, shortest program “wins”.

Can you explain the corollary of point 5? I find it highly counterintuitive.

if you said that in a square AB over CD then BC are always connected and AD are always disconnected that would be consistent, but you seem to be saying (in effect) that the squares aren't really squares and their shapes change subtly when you convert a # to a space or vice versa.

I've added a couple of tags to help categorize this beast. [optimized-output] is intended to represent you condition "The lists of coordinates need not be optimally short", and I would be happy if someone could find a better expression for it.

I’ve relaxed the conditions a little, so whether diagonally-adjacent things join up or not is now optional. I’ve also deleted my comments defending the old requirements.

Perl, 345 311 265 chars
s!.!$i{$x++}=$&eq'#'!ge,$x=$r+=64for<>;sub a{$d+=@_||3;$d%=4;$y=$x%64;$z=$x>>6;$c.=", ($y,$z)";}for$x(keys%i){if($c=!$v{$x}&$i{$x}&!$i{$x-1}){$i{($x+=(1,64)[$d^3])-(64,65,1)[$d]}?$i{$x-(65,1,0,64)[$d]}?a 1:($x-=(64,1)[$d]):a while$d||!$v{$x}++;print substr$c.$/,3}}

Limitations
Assumes that the input is no wider than 64 characters (but its height is in principle unbounded). This can be extended to 512 or 8192 or any other power of two by changing the relevant constants, making the code only slightly longer.
Slightly more readable version
Some credit goes to mob because the first line is my re-use of his idea in lasers. The rest is entirely my work.
# Read “%i”nput (this line is essentially mob’s idea, see above)
s!.! $i{$x++} = $& eq '#' !ge, $x = $r += 64 for <>;

# Subroutine to add a vertex to the current polygon and change the current “$d”irection
sub a
{
    $d += @_ || 3;
    $d %= 4;
    $y = $x % 64;
    $z = $x >> 6;
    $c .= ", ($y,$z)";
}

for $x (keys %i)
{
    # Go to the next “upward-pointing” edge that we haven’t already “%v”isited.
    if ($c = !$v{$x} & $i{$x} & !$i{$x-1})
    {
        # We’re going in the “$d”irection of 0=up, 1=left, 2=down, 3=right
        $i{($x += (1,64)[$d^3]) - (64,65,1)[$d]}
        ?  $i{$x - (65,1,0,64)[$d]}
           ?  a 1               # take a 90° turn to the left
           : ($x -= (64,1)[$d]) # move straight ahead
        : a                     # take a 90° turn to the right

        # Only stop if the current “$d”irection is “up” and we encounter a “%v”isited edge
        # (which necessarily is the one we started from)
        while $d || !$v{$x}++;

        # Remove “1, ” and output this polygon
        print substr $c.$/, 3
    }
}

Edits

(345 → 312) Realised there’s no need to update $x when taking a turn because the next iteration will already do it
(312 → 311) Change 1=down,2=left to 1=left,2=down and update $d via XOR instead of directly
(311 → 265) Remove repetition of the innermost expression and use arrays to parametrise it

Python, 607 characters
The code works by keeping a list of the boundaries discovered so far as it processes # symbols in input order.  The boundaries are stored in a table E which maps edges (4-tuples of x_start,y_start,x_end,y_end) to a list of edges which form the boundary of a polygon.  As we process each new #, it may be connected to a polygon above (p) or to its left (q).  The code finds p and q using E and then merges the boundary of the current # (r) with p and q, if they exist.  The case where p==q generates holes.
import sys
x=y=N=0
E={}
def P(L):
 if L:print ', '.join(map(lambda z:str(z[:2]),L))
while 1:
 r,a,b,c=[(x,y,x+1,y),(x+1,y,x+1,y+1),(x+1,y+1,x,y+1),(x,y+1,x,y)],(x+1,y,x,y),(x,y,x,y\
+1),sys.stdin.read(1)
 if not c:break
 p,q=E.get(a),E.get(b)
 if'#'==c:
  if p:
   i=p.index(a)
   if q:
    j=q.index(b)
    if p==q:
     if i<j:P(p[i+1:j]);p[i:j+1]=r[1:3]
     else:P(p[i+1:]+p[:j]);p[i:]=r[1:3];p[0:j+1]=[]
    else:p[i:i+1]=r[1:3]+q[j+1:]+q[:j]
   else:p[i:i+1]=r[1:]
  elif q:j=q.index(b);q[j:j+1]=r[:3];p=q
  else:p=r
  for e in p:E[e]=p
 x+=1
 if'\n'==c:y+=1;x=0
for L in E.values():
 if L:P(L);L[:]=[]

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/2.5/

sort: votes


text:
Code Golf: Number of paths!
Challenge

Consider a square matrix of order N(N
  rows and N columns). At each step you
  can move one step to the right or one
  step to the top. How many
  possibilities are to reach (N,N) from
  (0,0)?

Constraints

Assume input will be a positive integer N satisfying 1 <= N <= 125
No special characters, only 0-9
Output should be in a separate line for ever test-case.

Sample test Cases:
Input:
32
99
111
98
101
69
23
56
125
115

Output:
1832624140942590534
22750883079422934966181954039568885395604168260154104734000
360523470416823805932455583900004318515997845619425384417969851840
5716592448890534420436582360196242777068052430850904489000
360401018730232861668242368169788454233176683658575855546640
23623985175715118288974865541854103729000
8233430727600
390590044887157789360330532465784
91208366928185711600087718663295946582847985411225264672245111235434562752
90678241309059123546891915017615620549691253503446529088945065877600

Good luck!
The shorter an answer is, the better!

Without invoking any moderator superpowers, I'd like to say that I don't much like this kind of questions. The answer can be worked out in full detail on pencil and paper, which means that there is minimum room for programming cleverness: the most concise mathematical notation will win.

With all respect I choose to differ from your opinion,to me mathematics is a integral part of programming,and does mathematical cleverness is not the part of golfing? Anyways,I can probably assure that you that this problem will need programming cleverness along with mathematics precisely for languages that don't support big-integer by default :-)

For languages not supporting arbitrary-precision numbers I think this is pretty much impossible to compete. Of course, we know that not every task is doable in a short manner without bignums, but still, if that's the only source of need for programming cleverness ... well, that does not bode too well for the task, then :-)

It's certainly possible to write your own bignum code into an answer, but I don't think I have ever seen anyone actually do that for a golf question yet.

@gnibble:well,certainly there are many who did the same out of passion,I remember doing it too here just a year back.

@Joey:No that's not the only need for programming cleverness,computing the central binomial coefficients could be tricky to get a small solution given under constraints of time and source code limit :-)

@Debanjan: You don't need any binomial coefficients, it can be worked as a permutation problem: (2N)!/(N!)^2 paths, like Timwi did.

@dmckee:And what does $(2N)!/(N!)^2$ means? :-)Actually there exist a very fast and probably short solution that will compute the same,I will probably add one task in SPOJ utilizing this similar idea but only fairly optimized and short solution would pass,I guess that will more fun :-)

@Debanjan: I've golfed this to death with Project Euler problem 15 already and I'd be at 44 characters here (28 there). Except I don't have bignums and therefore cannot give the required output. As it stands I'm already uncompetitive and push me past C# even if I tried implementing bignums here. So at least for me this isn't very fun :-)

Almost a duplicate of http://codegolf.stackexchange.com/questions/1209/calculate-probability-of-getting-half-as-many-heads-as-coin-tosses - but that one requires division by 2^n as well.

J, 8
(!+:)~x:

x: forces arbitrary precision
+: doubles its argument
! is the binomial
a !+: b is the binomial of a out of 2*b
(!+:)~ b is the binomial of b out of 2*b

PARI GP
n->binomial(2*n,n)

Mathematica
Binomial[2#,#]&

Does that work for the input? I.e. one test case per line.

@Joey, Not particularly but i can't fix it right now. don't have access to eithor software.

@StOle:I am not sure but you may like to experiment here.

@debanjan, how would i test stdin and stdout at wolframalpha? can we?

I am not sure about that which I mentioned before. :-)

* is not necessary in Mathematica.

w..wh..WHAT IS WITH THAT SPACE??

C# (203 chars)
using System;using i=System.Numerics.BigInteger;class X{static void Main(){Func<i,i>f=null;f=n=>n<2?1:n*f(n-1);try{i p=i.Parse(Console.In.ReadLine());Console.WriteLine(f(2*p)/f(p)/f(p));Main();}catch{}}}

Readable:
using System;
using i = System.Numerics.BigInteger;
class X
{
    static void Main()
    {
        Func<i, i> f = null;
        f = n => n < 2 ? 1 : n * f(n - 1);
        try
        {
            i p = i.Parse(Console.In.ReadLine());
            Console.WriteLine(f(2 * p) / f(p) / f(p));
            Main();
        }
        catch { }
    }
}

Tricks I used:

Using try/catch instead of an explicit end condition for the main loop
Calling Main() recursively is slightly shorter than for(;;){...} or x:...goto x;

Why the try/catch? Only because Parse could throw? But this isn't Java and assuming sane input this won't ever happen, right?

@Joey: It’s because Parse will throw when the end of the stream is reached and Console.In.ReadLine() returns null. That’s how the infinite loop ends.

Ah, sorry then, didn't consider that

Blows the call stack on input 10^10^10^10

Ruby, 48 characters
#!ruby -n
s=1;1.upto(l=$_.to_i){|a|s+=s*l/a};p s

Python 67 57 Characters
while 1:s=i=1;n=input();exec"s=s*(n+i)/i;i+=1;"*n;print s

DC -- 27 character
 ?d2*[d1-d1<F*]dsFxrlFxd*/pq

Invoke it like
echo 125 | dc -e '?d2*[d1-d1<F*]dsFxrlFxd*/pq'

or
echo 23 | dc -f

The bit in the brackets is a recursive factorial, ? reads the standard input, and the rest is stack management and operations.

PARI/GP -- 14 bytes
n->(2*n)!/n!^2

Shorter than the built-in
n->binomial(2*n,n)

Vyxal, 3 bytes
d$ƈ

Try it Online!
Port of all the other answers
  ƈ # Binomial coefficient of...
d   # Double input
 $  # Input

2 bytes with r flag, ofc

Golf-Basic 84, 37 characters
l`A:1_S:1_Ii`N:(S*(N+I)/I:I++I)N_Sd`S

I can't test this right now, but I think that the the : and/or the multiplying of the result of I++I and an integer result from S*(N+I)/I will cause it to return ERR:UNDEFINED

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/2.5/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/