text:
Write a word equation solver
Introduction
Consider the following example:
  CODE
+ GOLF
——————
 GREAT

This is an equation where each letter represents a decimal digit and the words represent natural numbers (similar letters represent similar digits and different letters represent different digits). The task is to match each letter with its digit value so that the equation is correct. One solution for the equation above is:
  9265
+ 1278
——————
 10543

Your task
Your task is to write a program or a function which can solve such equations as seen above.
Input
The input is a string in the following format:
[A-Z]+\+[A-Z]+=[A-Z]+

Example:

CODE+GOLF=GREAT
AA+BB=CC

Spaces are omitted and only letters between capital A and Z will be used (no special or small letters).
This string can be read from the standard input, from a file, or as a function parameter.
Output
You have the following two options for the output format:

the original equation with the digits substituted
list of the letters and their values

If there are multiple solutions, any (but only one) of them should be returned. If there are no solutions, the program should return an empty string or null.
The output can be returned as a string, can be written to the standard output or a file.
Example:

9265+1278=10543
A=1 B=2 C=3 (you can use any delimiter)

Rules

To make things easier, numbers are accepted to start with 0, but you can handle numbers with leading 0 as invalid solutions, it's up to you
Similar letters represent similar digits and different letters represent different digits
You can use any language and the standard library of the chosen language (no external libs)
You cannot connect to any resources on the internet (why would you anyways?)
This is a code golf task, shortest code wins. Consecutive whitespace characters count as a single character. (So any program written in whitespace automatically wins)

I have a somewhat hackish solution using 179 chars. If something is not clear, please ask me in the comments.

I think the optimal answer is "everything is 0". You might want to specifically prohibit that.

What do you mean by everything is 0? Different letters have to denote different numbers.

Missed that, nevermind :)

If there are no solutions, the program should return an empty string or null. Infinite loops still output nothing ... may I?

To avoid abusing rule #5; you should rule out whitespace in strings.

All winning answers to this challenge effectively come down to exploiting the whitespace scoring rule, so close-voting as a duplicate.

Python - 48 characters
exec("".join(map(chr,map(len,'                                                                                '.split("    ")))))

Abusing the whitespace rule.
First I converted every character in CesiumLifeJacket's answer to its ASCII value (I could have written my own but I am lazy, and it wouldn't have affected the final score anyway). The long string in my solution is one space for each one of those ASCII values, and tabs separating them. Split at tabs, find the lengths, convert back to characters and execute.
SE converts tabs to 4 spaces each, so copypasting won't work. You'll just have to believe me :)

Can you provide a link to ideone, or a hex dump of your code?

Also: exec is a keyword, you could save 2 chars by removing the first and last bracket

Ruby 2.0, 122 characters
Brute force shuffling+eval!  This doesn't yet meet the criteria of returning null/empty string when there is no solution; it just loops infinitely.  If it can't find a result after ~300 million iterations, it will return nil.  Close enough?
f=->s{d=*0..9
d.shuffle!&&$.+=1until$.>9**9||z=eval((r=$_.tr(s.scan(/\w/).uniq*'',d*'')).gsub(/\b0/,'').sub ?=,'==')
z&&r}

It finds all the unique letters in the input, then repeatedly shuffles the digits 0-9 and attempts to match them up with the letters until it finds a configuration that works.
The code is presented as a function called f which returns a string with the numbers substituted, as in Output Option 1 above.  Example usage:
puts f["AA+BB=CC"]
 #=> 22+44=66
puts f["CODE+GOLF=GREAT"]
 #=> 8673+0642=09315

Running time for the CODE+GOLF=GREAT example on my machine varies from instantaneous to about 6 seconds - depends on how lucky you are with the shuffles!
I'm particularly unhappy with the gsub(/\b0/,'') bit to remove leading zeroes but it was the only thing I could think to prevent eval from interpreting the numbers as octal ints.
(BONUS: Because it uses eval, it works for arbitrary Ruby expressions and not just addition!)

I had the same idea when I read this, but I got ~170 chars of code, so well done. 0..9 are ten digits, so shouldn't the limit be 10**10? You could use Array#permutation to loop over all possible mappings, but that might make the code longer.

@blutorange I just chose 9**9 because it was a big number you could write with few characters.  It should be more than enough for any reasonable test cases I think!  I haven't tried a version based on permutation, but as you say, I was primarily concerned with code length.

LiveScript (179 chars)
It has deterministic and relatively quick running time and works with other operators (+, -, *) as well.
f=(s)->                     # define function that takes parameter s
  c=s.replace /[^A-Z]/g ''  # remove all the non-letters
  if c                      # if any letters remain
    for i from 0 to 9       # loop from 0 to 9
       if s.indexOf(i)<0&&a=f s.split(c.0).join i  # if i is not present in the number, replace the first letter with i and call the function recursively
         return a           # if there is a solution, return it
  else                      # if there are no letters left
    if eval s.replace(/(^|\D)0+(\d)/g,'$1$2').replace \= \==  # if the expression is correct (we need to remove leading 0, because javascript interprets numbers with leading 0 as octal)
       return s  # return solution

f("CODE+GOLF=GREAT")

Python, 256 213 chars
Horrific running time, will try to improve further:
q='='
e=input()
v=set(e)-set([q,'+'])
for x in __import__('itertools').permutations(range(10),len(v)):
    t=e
    for l,n in zip(v,x):t=t.replace(l,str(n))
    try:
        if eval(t.replace(q,q*2)):print(t);break
    except:pass

JavaScript 138
for(s=prompt(p='1');eval(p.replace('=','!='));)for(p=s,i=64;i++<90;)p=p.replace(new RegExp(String.fromCharCode(i),'g'),10*Math.random()|0)

Random bruteforce.
Can take a while (my best shot for CODE+GOLF=GREAT is 3 seconds, my worst 3 minutes).
Try it with a simple expression like A+B=C

Haskell, 222
import Data.List
z=(\(b,(_:c))->b:z c).span Data.Char.isUpper
j(Just g)=g
main=interact$(\d@[a,b,c]->show$take 1[e|e<-map(zip$nub$d>>=id)$permutations['0'..'9'],(\f->f a+f b==(f c::Int))(read.map(j.(`lookup`e)))]).take 3.z

Brute force. Tries every possible matching until it finds one, or after it has finished trying them all. I stretched the output rules: prints something like [[('C','3'),('O','8'),('D','6'),('E','7'),('G','0'),('L','5'),('F','2'),('R','4'),('A','1'),('T','9')]] for the solution, and if none exists, prints []. Let me know if I need to change this.

I think, this output is acceptable.

CJam - 17
"

    ""
"f#3b127b:c~

Total 975 characters, but 960 of them are whitespace in 2 sequences, so those count as 2 characters, and together with the other 15, we get 17.
975 may seem like a lot, but note that undergroundmonorail's python solution has 18862 characters, they're just on a single line :)
You can run it at http://cjam.aditsu.net/ for short words, but you should probably use the java interpreter for longer ones. With java on my laptop, SEND+MORE=MONEY runs in 30-40 sec and CODE+GOLF=GREAT in almost 3 min. It doesn't accept numbers starting with 0 (because that's not cool).
Here's a program that generates the program above (also helps if StackExchange doesn't show the whitespace correctly):
"{L__&=}:U;
{L!!{L))_9>{;:L;I}{+:L;}?}*}:I;
{{U!_{I}*}g}:M;
{L,N<L,g&}:K;
{I{K{L0+:L;}*MK}g}:G;
{{C#L=}%si}:R;
{XRYR+ZR=PRAb0#0<&}:F;
l'+/~'=/~:Z;:Y;:X;
[X0=Y0=Z0=]:P;
XYZ++_&:C,:NB<{0a:L;{F0{GL}?}g}*
L{XR'+YR'=ZR}{L}?"
127b3b[32 9 A]:cf='"\'"_32c9cAc"\"f#3b127b:c~"

The first 11 lines contain the original program (not really golfed) in a string, and the last line does the conversion and adds the decoding part.

PHP, 118 113 bytes
for(;;)eval(strtr($argn,"=".$w=substr(count_chars($argn,3),2),"-".$n=str_shuffle(1234567890))."||die('$w
$n');");

prints digits below letters and exits program; loops infinitely if unsolvable. Run as pipe with -nr.
breakdown
for(;;)
    eval(                               # 6. evaluate
        strtr($argn,                    # 4. translate letters to digits, "=" to "-"
            "=".$w=substr(              # 2. remove non-letters
                count_chars($argn,3)    # 1. get characters used in the argument
                ,2),
            "-".$n=str_shuffle(1234567890)  # 3. shuffle digits
        )."||die('$w\n$n');"            # 5. if falsy (`A+B-C==0`), print translation and exit
    )
;

PHP, 145 bytes
function f($s){for(;$i<10*preg_match("/[A-Z]/",$s,$m);)strpos(_.$s,++$i+47)||f(strtr($s,$m[0],$i-1));$i||eval(strtr($s,"=","-")."||die('$s');");}

recursive function, prints solved equation and exits program; returns NULL when unsolvable.
Try it online
breakdown
function f($s)
{
    for(;
        $i<10                   # loop $i from 0 to 9
        *preg_match("/[A-Z]/",$s,$m)    # find a letter; if not found: $i<10*0 == falsy
        ;
    )
        strpos(_.$s,++$i+47)            # find $i in string
        ||f(strtr($s,$m[0],$i-1));      # if not found, replace letter with $i, recurse
    $i||                        # no letter found ($i is unset):
        eval(                   # evaluate:
            strtr($s,"=","-")       # replace "=" with "-"
            ."||die('$s');"         # if falsy (A+B-C==0), print equation, exit program
        );
    # else implicitly return NULL
}

Powershell, 137 bytes
port of LiveScript
$f={param($s)if($c=$s-replace'[^A-Z]'){0..9|?{$s-notmatch$_}|%{&$f ($s-replace$c[0],$_)}|Select -f 1}elseif($s-replace'=','-eq'|iex){$s}}

Ungolfed test script:
$f={

param($s)                           # parameter string
$c=$s-replace'[^A-Z]'               # remove all the non-letters
if($c){                             # if any letters remain
    0..9|?{                         # loop from 0 to 9
        $s-notmatch$_               # if $s is not contains current number
    }|%{
        &$f ($s-replace$c[0],$_)    # replace the first letter with current number and call the function recursively
    }|Select -f 1                   # seelct first non-null value (break if found)
}
elseif($s-replace'=','-eq'|iex){    # else if evaluated value if the expression is $true
    $s                              # return $s as solution
}

}

&$f "AA+BB=CC"
&$f "A+AB=A"            # empty because it has no solution
&$f "CODE+GOLF=GREAT"

Output:
11+22=33
2846+0851=03697

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳


text:
Find the maximum of 3 numbers without branching
This time around your goal is to find the maximum of 3 integers (from -(2^31) to 2^31 - 1 in binary 2's complement) without using branching or loops.
You are only allowed to use

Inequality/Equality (==, >, >=, <, <=, !=) These count as 2 tokens.
Arithmetic (+, -, *, /)
Logical Operators (! not, && and, ||  or)
Bitwise Operators (~ not, & and, | or, ^ xor, <<, >>, >>> arithmetic and logical left and right shifts)
Constants. 0 tokens
Variable assignment. 0 tokens

Input 3 variables as a, b and c. Output the maximum number.
Standard atomic code-golf rules apply. If you have any questions please leave them in the comments. One token is any of the above with the special rules.

What about defining an extra function? If this is allowed, how many tokens does it count as?

@voidpigeon You are only allowed to have one function, the one that takes the 3 inputs and outputs.

At first glance I thought, "we've had this before.", but I think comparators costing 2 changes the game quite a bit.

@primo I specifically asked for 3 inputs because it actually allows for some interesting improvements

Can the integers be repeated? eg: f(3,3,3)? And is integer division allowed?

@Ourous Yes, just return or output the maximum. I'll allow integer division.

Can we use inbuilt functions?

Can we use : and ??

@Joshpbarron, that would be branching

ARM assembly has non-branching conditional instructions. Can I use those?

Javascript 10 tokens
Edit Using < and * instead of bit fiddling - as pointed out in comments, bits operations may fail for input near the range limit (over 30 bits)
function Max(x,y,z)
{
  var d=y-x;
  x=y-d*(d<0);
  d=x-z;
  return x-d*(d<0);
}

C 8 tokens
Language agnostic in fact, any C like language will do. To be picky, in standard C it's not portable because right shift may not extend the sign (but in common implementations it does).
In C (and C++, C#, and Java I think) we can easily handle overflow problems using bigger temporary values:
int Max(int x, int y, int z)
{
    long long X = x;
    long long Y = y;
    long long Z = z;
    long long D = Y-X;
    X=Y-((D>>63)&D);
    D=X-Z;
    return (int) (X-((D>>63)&D));
}

I'm being picky, but using C ints your code doesn't work for x=2147483647, y = -2, z=0. Your choice if you want to change it

Javascript
6 tokens
function maxOf3(a, b, c) {
    (b>a) && (a=b);
    (c>a) && (a=c);
    return a;
}

+1 I see shortcut evaluation as a type of branching, but it's not forbidden in the rules

I would consider this as branching, haha

@edc65 It is. Allowing && and || was likely an oversight, which should be pointed out, rather than exploited.

@primo This was an interesting issue. I believe some CISC architectures have instructions that include conditional statements, so I'm not sure how those would be counted.

I guess it should be 4 tokens i.e 2 &&, < and >. The = is used as an assignment and counts as 0

@ClydeLobo It's 6 because < and > cost double.

C: 10 tokens
int max(int a, int b, int c)
{
    a += (b > a) * (b - a);
    a += (c > a) * (c - a);
    return a;
}

Inspired by @openorclose's answer, but converted to C and made branchless using multiplication rather than short circuit boolean operators.

Javascript
14 tokens
function max (a, b, c)
{
    var ab = (a >= b) * a + (a < b) * b;
    return (ab >= c) * ab + (ab < c) * c;
}

You are not allowed to create new functions

:( 14 tokens then

Many languages (Python) (10 tokens)
def max3(x,y,z):
    m = x ^ ((x ^ y) & -(x < y))
    return m ^ ((m ^ z) & -(m < z))

print max3(-1,-2,-3) # -1
print max3(-1,2,10) # 10

https://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
Oh, someone already posted it :)

You are not allowed to create new functions

Ahh ok! Didn't read the comments :)

@qwr I don't get it, you said: You are only allowed to have one function, the one that takes the 3 inputs and outputs. That's exactly what this answer has. The 2 prints are just test cases

@Cruncher I edited the answer I did max2(max2(x,y),z) initially :)

@Mardoxx ah. Well +1

C++11: 15 tokens
Using only arithmetic and bitwise operators (since equality and boolean logic operators make it too easy)...
#include <iostream>

auto max(int32_t a, int32_t b, int32_t c)->int32_t {
  return c - ((c - (a - ((a - b) & (a - b) >> 31))) & (c - (a - ((a - b) & (a - b) >> 31))) >> 31);
}

auto main()->int {
  // test harness
  std::cout << max(9, 38, 7) << std::endl;
  return EXIT_SUCCESS;
}

Fail for big numbers (>2^30), see comment http://codegolf.stackexchange.com/questions/32476/#comment68870_32477

Looks fine to me: http://ideone.com/pEsvG3

Did you atctually read the comment? I think 2billions is greater than 0 [http://ideone.com/vlcnq9 ]

Ah i see; yes it does have a problem with those numbers in your other comment, when a 0 is involved.  But not for 2^30 as you said.  http://ideone.com/LicmXa

It's not the 0 involved. The problem are big numbers and overflow, try max(2000000000, -200000000, 1111111111).

J (Not competing)
I was just wondering what the a solution in J would look like. This uses a , and a # though, so it won't be competing.
((a<b),(b<c),(c<a))#b,c,a

This would compete, but is way too long, with 9 tokens:
(b*a<:b)+(c*b<c)+(a*c<a)

we have the following assumptions:

max(a;b)=(a+b + |a-b|)/2
max(a;b;c)=max(max(a;b);c)
abs(a)=(a + (a >> 31)) ^ (a >> 31)

we can use the pseudo-code:

function max(a,b,c)
{
out1=( (a+b) +  (( (a-b) + ((a-b) >> 31)) ^ ((a-b)>> 31))) div 2
out2=( (out1+c) +  (( (out1-c) + ((out1-c) >> 31)) ^ ((out1-c)>> 31))) div 2
return out2
}

Please write actual code, and provide the count of tokens in your answer.

C# (2nd try)
I got it... No integrated functions...
But is it allowed to use other integrated datatypes or just plain int? If allowed I would propose:
int foo2(int a, int b, int c)
{
   var x = new SortedList<int,int>();

   x[a] = 1;
   x[b] = 1;
   x[c] = 1;

   return x.Keys[2];
}

javascript 8 tokens
although similar to @openorclose's answer, i do actually use the logical operators for the assignment itself.
function max( a, b, c ) {
    x=( a > b && a) || b;
    return ( x > c && x ) || c;
}

fiddle

R (10 tokens)
function max(a, b, c) {
  max <- a
  max <- max + (b - max) * (b > max)
  max <- max + (c - max) * (c > max)
  return(max)
}

Brainfuck (Not competing)
>,[-<+>>>+<<]>,[-<+>>>+<<]>[>[-<->>]<<]<[-]>[-]>[-]<<<[->>>>+<<<<]>>>>[-<+>>>+<<]>,[-<+>>>+<<]>[>[-<->>]<<]<<

TIS-100, 8 operations
MOV ACC UP #A
SUB UP     #B
SUB 999
ADD 999
ADD UP     #B
SUB UP     #C
SUB 999
ADD 999
ADD UP     #C
MOV ACC DOWN

The provider(UP) only do MOVs so not shown in the code
Maybe not work when too near the 999 edge

VBA (6 tokens)
 Function max3(a As Integer, b As Integer, c As Integer)
 i = IIf(a >= b And a >= c, a, IIf(b >= c, b, c))
 max3 = i
 End Function

not sure if this is not branching.

It is branching, only inline. Specifically, the ubiquitous ternary operator (which this essentially is) is not one of the allowed operations.

Thanks @tomsmeding, may I ask what is the ubiquitous ternary operator (is it IIF() in my code?)

yes sorry, with ubiquitous I meant that it's present in pretty much every language, and the ternary operator is your IIf, Inline-If. In most languages, it is, for example, a>=b ? a : b. It is branching indeed.

JavaScript: 4 tokens (** based on broad interpretation of "assignment"!)
Obviously my score of 4 is extremely generous/lenient!
To arrive at that score I've assumed "assignment" (worth 0 tokens in the question) includes such things as additive assignment, subtractive assignment, multiplicative assignment, and XOR-ing (^=) assignment
function f(a, b, c) {
  d = a;
  d -= b;
  d = d >= 0;

  a *= d;  //a = a if (a>=b), else 0
  d ^= true; //invert d
  b *= d;  //b = b if (b<a), else 0

  a += b;  //a is now max(a,b)

  d = a;
  d -= c;
  d = d >= 0;

  a *= d;  //a = a if (a>=c), else 0
  d ^= true; //invert d
  c *= d;  //c = c if (c<a), else 0
  a += c;  //a is now max(max(a,b),c)

  return a;
}

If those assignments actually count the score is 14 :)

Because d -= b is actually the same as d = d - b, I would say that you use arithmetic and that you should count this as a token.

Yes, I realise that - I was (jokingly) trying to take advantage of the meaning of "assignment".  I think I made that fairly obvious!

source: Stack Exchange

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

sort: votes


text:
Longest mathematical expression in a grid
Given a grid which contains these signs: 0..9, x, =, write the fastest code that outputs the longest string of connected (horizontally, vertically, and diagonally adjacent), distinct cells which is a mathematically valid expression formed on this grammar:
E := T '=' T
T := F 'x' T | F
F -> {0..9}+

More formally, a solution will have this form: an equality between a product of terms:
S = F0 x .. x Fp = Fp+1 x .. x Fn
I define N(S) = Max_i(F_i)
If two strings of the same length need to be compared, then I will compare their largest multiplicand. i.e.  30x3=90 < 33x3=99 because  90 < 99
 The grids
Grid 0: 3 x 3
13x
=73
481

which contains: 13x37=481
Grid 1: 7 x 9
6996640
1127=39
186=940
8329706
3683980
6349307
75x19x0
5065350
0051900

which contains:
a=611333
b=599999
c=494687
d=531337
and a*b=366799188667
and c*d=262845506519

Grid 2: 8 x 8
1851x412
40081737
72330964
14461858
17604=67
89653745
13612200
14433193

Grid 3:  16 x 16
0951x71=7=41659x
958525855332=25x
8462=1x119191x76
993928209055089x
1523060251420490
=883152021094970
0146645532106152
87x96=294=x80675
7960948222x0440x
x577x987x0993241
29564563x=x5=800
03508x17050=6565

OK so after a short discussion in the comment sections, I am adding a few restrictions to allow me to do a fair comparison of solutions:
I will run the solution on my Macbook Pro which is 2,4 GHz Core 2 Duo running Mavericks. The language you are going to propose needs to be running natively on my computer, but fortunately, a lot of languages are available on OS X.
I will measure the quality of a program by comparing the time taken to find my hidden solution. Your program will probably find strings that are even longer that the one I hid in the first place, but this can not be avoided as I would need a program that enumerates all the solution of the grids I'm going to submit.. and this is the reason of this code golf..

Do you mean the largest factor (in which case presumably it's the largest factor of the value of each side of the =) or the largest multiplicand?

Ah one more thing. It may well be the case that some solutions won't be able to solve your larger grids. To not exclude them from the competition, you could do the following: add grids of regularly increasing sizes (say, 3x3, 4x4, 5x5, ... 15x15). Then the winner is the program that can handle the largest size in 10/30/60 minutes (some fixed time, depends on how long you want to the programs to run on your machine). If multiple programs tie at the same size, the tie is broken by actual runtime. This makes it also fairer to add new test cases, when submissions solve the largest size.

I am currently writing a program that generates those grids. Just a few minutes.. Please comment on the comparison of strings of the same length.

In the expression A × B = C, A is the multiplier, B is the multiplicand, and C is the product. Did you want the sum with the largest product, perhaps?

@squeamishossifrage No, the specification is quite clear I think. In A x B = C x D, he wants the solution with largest maximum among A, B, C, D. You could call it "factor" instead of "multiplicand" but, as Peter Taylor commented, that suggests that he's looking for the product with the largest prime factor. (At least that's how I understood him.)

From what I understand, this challenge breaks down to an graph traversing one. I'm pretty determined to find an solution at this point, I'll notify you when I make some more progress. Also: would (for example) 1337=1337=1337 be valid?

1337=1337=1337 is not valid according to the grammar. Also, I specified distinct cells, which means that cells are used only once in a solution.

Regarding your question in the post, I think you should provide the solution for the first two test cases or so, so people have something to check. Don't provide them for the others, though. By the way, have you thought about my above suggestion regarding the scoring (to account for algorithms which can't solve the largest grids in a reasonable amount of time?).

Would this simple rule be fair: for each grid, I define a time, and the score would be equal to the mathematical value of 'T' found around the equal sign when time is over ? And I remove that multiplicand stuff.. which seems a bit useless.

@user3585425 I like going by the largest value around the equals sign, but I don't think I like the rest of that. I'd say, just go by "The winner is the person who can solve the largest grid within X minutes. If two participants tie by this criterion, the algorithm which solves that grid faster wins.", where X is some fixed pre-defined time, and depends on how much time you want to spend running the submissions. That would be a very fair criterion which would put no one off, and you could always add larger grids if people solve all grids.

In that case, I'd prefer though, if you actually had one grid for each consecutive size (and only square sizes to keep the number of test cases manageable). By the way, this scoring would be similar to what Lembik did here.

OK. Sorry for the mess. Generating board is actually trickier that I thought. If you have a suggestion to help me pack those strings in a given space and in a random way, I would appreciate. Some kind of shuffle in a 2D grid which maintains connectivity.

Let us continue this discussion in chat.

@user3585425 did you actually see my response in the chat room?

@user3585425 I have written a grid generator in Ruby: https://github.com/mbuettner/ppcg-product-grid/blob/master/generate-grid.rb ... You can run it like ruby generate-grid.rb w h eq, where w and h are height and width of the grid and eq is an equation you want to hide. If eq doesn't take up more than say 75% of the cells in the grid it doesn't take too many attempts to find a random path for the equation.

C, checks about 7,500,000 paths per second
So here is my first pass over this. It's quite horrible code because it's all in one huge main and the two (nested) loops over the left-hand side and right-hand-side of the equation are pretty much exactly the same, but well, it works.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

#define MAX_SIZE 32

typedef struct {
    char symbol;
    int visited;
} cell;

typedef struct {
    int x;
    int y;
} coord;

static cell grid[MAX_SIZE][MAX_SIZE];
static int nEquals = 0;
static coord equals[MAX_SIZE*MAX_SIZE];

static coord dirs[8] = {
    { .x = -1, .y = -1 },
    { .x =  0, .y = -1 },
    { .x =  1, .y = -1 },
    { .x =  1, .y =  0 },
    { .x =  1, .y =  1 },
    { .x =  0, .y =  1 },
    { .x = -1, .y =  1 },
    { .x = -1, .y =  0 },
};

static char best_string[2*MAX_SIZE*MAX_SIZE+1];
static int best_length = 0;
static unsigned long long best_factor;

int main(int argc, char *argv[])
{
    FILE *fp = fopen("grid.txt", "r");
    if (!fp) perror("Memory allocation failed"), exit(1);

    fseek(fp, 0L, SEEK_END);
    long lSize = ftell(fp);
    rewind(fp);

    char *buffer = calloc(1, lSize+1);
    if (!buffer)
    {
        fclose(fp);
        perror("Memory allocation failed");
        exit(1);
    }

    if (1 != fread(buffer, lSize, 1, fp))
    {
        fclose(fp);
        free(buffer);
        perror("Reading file failed");
        exit(1);
    }

    fclose(fp);

    char *cp;
    cp = buffer;
    int width = (int)strtol(cp, &cp, 10);
    int height = (int)strtol(cp, &cp, 10);

    ++cp;
    int i, j;
    for (j = 0; j < height; ++j)
    {
        for (i = 0; i < width; ++i)
        {
            grid[j][i].symbol = *cp;
            grid[j][i].visited = 0;

            if (*cp == '=')
            {
                equals[nEquals].x = i;
                equals[nEquals].y = j;
                ++nEquals;
            }
            ++cp;
        }
        ++cp;
    }

    printf("Analysing %d x %d grid...\n", width, height);

    unsigned long long strings_checked = 0;

    clock_t start = clock();

    for (j = 0; j < nEquals; ++j)
    {
        char expression[2*MAX_SIZE*MAX_SIZE+1];
        coord lpos = equals[j];
        coord rpos = equals[j];

        // Set to spaces to ease parsing
        for (i = 0; i < 2*MAX_SIZE*MAX_SIZE+1; ++i)
            expression[i] = ' ';

        int center = MAX_SIZE*MAX_SIZE;
        expression[center] = '=';

        int lhs_size = 0;
        int lhs_n_factors = 0;

        int lhs_dirs[MAX_SIZE*MAX_SIZE];
        for (i = 0; i < MAX_SIZE*MAX_SIZE; ++i)
            lhs_dirs[i] = -2;
        int rhs_dirs[MAX_SIZE*MAX_SIZE];
        for (i = 0; i < MAX_SIZE*MAX_SIZE; ++i)
            rhs_dirs[i] = -2;

        unsigned long long lhs_factors[MAX_SIZE*MAX_SIZE];
        unsigned long long lhs_max_factors[MAX_SIZE*MAX_SIZE];
        unsigned long long lhs_products[MAX_SIZE*MAX_SIZE];
        lhs_max_factors[0] = 0;
        lhs_products[0] = 1;

        while (lhs_size >= 0)
        {
            int dir = ++lhs_dirs[lhs_size];
            char lmost_char = expression[center-lhs_size];

            if (dir == -1)
            {
                grid[lpos.y][lpos.x].visited = 1;

                if (lmost_char == 'x')
                {
                    unsigned long long factor = strtoll(expression+center-lhs_size + 1, NULL, 10);
                    lhs_factors[lhs_n_factors] = factor;
                    ++lhs_n_factors;
                    if (factor > lhs_max_factors[lhs_n_factors-1])
                        lhs_max_factors[lhs_n_factors] = factor;
                    else
                        lhs_max_factors[lhs_n_factors] = lhs_max_factors[lhs_n_factors-1];
                    lhs_products[lhs_n_factors] = lhs_products[lhs_n_factors-1] * factor;
                    continue;
                }
                else if (lmost_char == '=')
                    continue;
                else
                {
                    unsigned long long factor = strtoll(expression+center-lhs_size, NULL, 10);
                    unsigned long long max_lhs_factor;
                    if (factor > lhs_max_factors[lhs_n_factors])
                        max_lhs_factor = factor;
                    else
                        max_lhs_factor = lhs_max_factors[lhs_n_factors];

                    unsigned long long lhs_product = lhs_products[lhs_n_factors] * factor;

                    int rhs_size = 0;

                    int rhs_n_factors = 0;
                    unsigned long long max_rhs_factor = 0;

                    unsigned long long rhs_factors[MAX_SIZE*MAX_SIZE];
                    unsigned long long max_factors[MAX_SIZE*MAX_SIZE];
                    unsigned long long rhs_products[MAX_SIZE*MAX_SIZE];
                    max_factors[0] = max_lhs_factor;
                    rhs_products[0] = 1;

                    char *rhs_factor_pointers[MAX_SIZE*MAX_SIZE];
                    rhs_factor_pointers[0] = expression+center+1;

                    while (rhs_size >= 0)
                    {
                        int dir = ++rhs_dirs[rhs_size];
                        char rmost_char = expression[center+rhs_size];

                        if (dir == -1)
                        {
                            grid[rpos.y][rpos.x].visited = 1;

                            if (rmost_char == 'x')
                            {
                                factor = strtoll(rhs_factor_pointers[rhs_n_factors], NULL, 10);
                                rhs_factors[rhs_n_factors] = factor;
                                ++rhs_n_factors;
                                rhs_factor_pointers[rhs_n_factors] = expression + center + rhs_size + 1;
                                if (factor > max_factors[rhs_n_factors-1])
                                    max_factors[rhs_n_factors] = factor;
                                else
                                    max_factors[rhs_n_factors] = max_factors[rhs_n_factors-1];
                                rhs_products[rhs_n_factors] = rhs_products[rhs_n_factors-1] * factor;
                                continue;
                            }
                            else if (rmost_char == '=')
                                continue;
                            else
                            {
                                // check for solution
                                ++strings_checked;

                                factor = strtoll(rhs_factor_pointers[rhs_n_factors], NULL, 10);
                                unsigned long long max_factor;
                                if (factor > max_factors[rhs_n_factors])
                                    max_factor = factor;
                                else
                                    max_factor = max_factors[rhs_n_factors];

                                unsigned long long rhs_product = rhs_products[rhs_n_factors] * factor;

                                //printf("%.19s = %d\n", expression + center - 9, rhs_product);
                                //  printf("%.51s\n", expression + center - 25);
                                int length = rhs_size + lhs_size + 1;

                                if (lhs_product == rhs_product &&
                                    (length > best_length ||
                                     length == best_length && max_factor > best_factor))
                                {
                                    best_length = length;
                                    best_factor = max_factor;
                                    memcpy(best_string, expression + center - lhs_size, length);
                                    best_string[length] = 0;
                                }

                            }
                        }
                        else if (dir < 8)
                        {
                            coord step = dirs[dir];
                            int new_x = rpos.x + step.x;
                            int new_y = rpos.y + step.y;
                            char new_char;

                            if (new_x < 0 || new_x >= width ||
                                new_y < 0 || new_y >= height ||
                                grid[new_y][new_x].visited ||
                                (new_char = grid[new_y][new_x].symbol) == '=' ||
                                new_char == 'x' && (rmost_char == 'x' || rmost_char == '=')) continue;

                            // TODO: Should diagonally crossing paths be disallowed, too?

                            ++rhs_size;

                            rpos.x = new_x;
                            rpos.y = new_y;
                            expression[center+rhs_size] = new_char;
                        }
                        else
                        {
                            if (rmost_char == 'x')
                                --rhs_n_factors;

                            rhs_dirs[rhs_size] = -2;
                            if (rmost_char != '=') expression[center+rhs_size] = ' ';
                            grid[rpos.y][rpos.x].visited = 0;

                            --rhs_size;
                            coord step = dirs[rhs_dirs[rhs_size]];
                            rpos.x -= step.x;
                            rpos.y -= step.y;
                        }
                    }
                }
            }
            else if (dir < 8)
            {
                coord step = dirs[dir];
                int new_x = lpos.x + step.x;
                int new_y = lpos.y + step.y;
                char new_char;

                if (new_x < 0 || new_x >= width ||
                    new_y < 0 || new_y >= height ||
                    grid[new_y][new_x].visited ||
                    (new_char = grid[new_y][new_x].symbol) == '=' ||
                    new_char == 'x' && (lmost_char == 'x' || lmost_char == '=')) continue;

                // TODO: Should diagonally crossing paths be disallowed, too?

                ++lhs_size;

                lpos.x = new_x;
                lpos.y = new_y;
                expression[center-lhs_size] = new_char;
            }
            else
            {
                if (lmost_char == 'x')
                    --lhs_n_factors;

                lhs_dirs[lhs_size] = -2;
                expression[center-lhs_size] = ' ';
                grid[lpos.y][lpos.x].visited = 0;

                --lhs_size;
                coord step = dirs[lhs_dirs[lhs_size]];
                lpos.x -= step.x;
                lpos.y -= step.y;
            }
        }
    }

    clock_t end = clock();
    float seconds = (float)(end - start) / CLOCKS_PER_SEC;

    printf("Checked %llu paths.\n", strings_checked);

    printf("Took %f seconds.\n", seconds);

    printf("Result: %s\n", best_string);
}

This expects the input stored in a file grid.txt. The first line is the space-separated size of the grid, which is followed by the grid itself. Like:
3 3
13x
=73
481

The algorithm is currently checking all possible well-formed paths (brute force). By well-formed, I mean that paths containing xx or two = are skipped, and I only start looking for paths starting from a = in both directions. Basically, I check all possible LHSs and for each such path, I check all possible RHSs. Over the next few days, I plan to add several optimisations to skip more paths, since the runtime per path will only go up and not down from here.
This will run into some problems with grid sizes of more than some 20 cells, due to integer overflow. I'll have to use some bigint-library when I get to solving those in a reasonable amount of time (which, I'm afraid, will reduce the paths/second a bit).
Currently, the largest sizes that can be solved in a reasonable amount of time at the moment are 7x3 or 5x4 (both taking under two minutes). 8x3 would take about half an hour, and 9x3 or 6x4 or 5x5 would take a few hours (between 1 and 7 I think).
EDIT: Managed to speed it up by close to 20 percent, because now I'm parsing each multiplicand when it's "locked" (i.e. when an x next to it has been parsed) instead of parsing the entire right-hand side for each possible path. And I should add that I observed those 20% for a grid where there's only a single x to be found, so I expect the performance gain for grids with many x to actually be quite substantial. Next stop: bigints.

Python + networkx (Bruteforce, checks about 10000 paths per second on my machine)
It's not fast, but it works at least. Checks literally every path.
Amount of cycles necessary can be found here. This program solved a 5*6 in half an hour.
TODO:
replace eval by something less terrible.  Done.
__author__ = 'Synthetica'

import networkx as nx
import itertools as it
import time as tm

def main():
    longest = 0
    data = ['6996640', '1127=39', '186=940', '8329706', '3683980', '6349307',
            '75x19x0', '5065350', '0051900']

    hor = len(data[0])
    vert = len(data)

    threads = 8
    G = nx.grid_2d_graph(vert, hor)
    # Q = qu.LifoQueue(maxsize=1000)
    #W = mp.Pool(threads)
    #W.map_async(evalexpr, [Q]*threads)
    printevery = 10**4
    tested = 0
    t = tm.time()
    for node in it.product(G.nodes(), repeat=2):
        if node[0]==node[1]:
            continue
        for path in nx.all_simple_paths(G, source=node[0], target=node[1]):
            tested += 1
            path = "".join(data[x][y] for x, y in path)
            if tested > printevery:
                ot = t
                t = tm.time()
                tested = 0
                print printevery, "tested. Speed:", printevery/(t-ot), "s**-1"
            if not all((path.count('=')==1, 'x' in path, len(path) >= longest)):
                continue
            #newpath = path.replace('=', '==').replace('x', '*')
            try:
                #print "Calling eval on", newpath
                parts = path.split("=")
                part0 = parts[0].split('x')
                part1 = parts[1].split('x')

                part0 = map(int,part0)
                part1 = map(int,part1)

                part0 = reduce(int.__mul__, part0)
                part1 = reduce(int.__mul__, part1)

                result = part0 == part1

            except:
                result = False
            if result:
                print 'Found new best:',path
                longest = len(path)

if __name__ == "__main__":
    main()

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


text:
Finding internal rate of return (IRR)
In investing, internal rate of return (IRR), the continuously compounded rate of return economically equivalent to a specified series of cashflows, is often a valuable concept.
Your challenge is to demonstrate how to compute IRR in the language of your choice in as few bytes as possible, subject to the following conditions:

Your code should accept arbitrary cashflows, subject only to the condition that the initial cashflow is negative.
You can assume that the cashflow has already been assigned to a variable f (use some other variable name if 'f' is a command name in your language).
Assume cashflow is specified as a series of (date, datum) pairs, in whatever format is most convenient for your language. This challenge is about the IRR computation, not parsing the input.
All functions built into your language are allowed except IRR() or the equivalent, if your language has it, because that's not interesting.
Output should be a real number (thus, 0.14, not "14%").

The solution requires numerical root-finding, and different methods and starting conditions will find slightly different answers. For the purposes of the contest, if you're within 0.001 of the answer reached by Excel's XIRR function, you're close enough.
Example 1:
f={{{2001, 1, 1}, -1}, {{2002, 1, 1}, .3}, {{2005, 1, 1}, .4}, {{2005, 1, 10}, .5}};

0.0584316

Example 2:
f = {{{2011, 1, 1}, -1}, {{2012, 2, 1}, -.3}, {{2015, 3, 1}, .4}, {{2015,3,15},.01}, {{2015, 4, 10}, .8}};

-0.2455921

Example 3:
f = {{{2011, 1, 1}, -1}, {{2012, 2, 1}, 3.3}, {{2015, 3, 1}, 5.4}, {{2015,3,15}, 6.01}, {{2015, 4, 10}, 17.8}};

2.4823336

More information available at http://en.wikipedia.org/wiki/Internal_rate_of_return

What about cases where there are multiple roots?

@PeterTaylor discard any imaginary roots. In the case of multiple real roots, either report all, or any one.

Minimizing the size of code is only one aspect of it. Newton-Raphson method is not the appropriate of numerical methods to find IRR. There are far better numerical algorithms as compared to NR that produce IRR values when Newton-Raphson method fails The use of 1st, 2nd, 3rd and 4th order Taylor polynomial approximations along with use of remainder term and zero, 1st, 2nd and 3rd order Taylor polynomial approximations produce multiple IRR values where the 3rd order Taylor polynomial approximation out performs any IRR algorithm that I have known and I happen to know roughly 60 different IRR find

@Finance101 A reasonable point, but it feels like the subject of a separate contest. Perhaps one in which numerous difficult test problems are shown and the challenge is to demonstrate a method that solves all of them correctly.

Maxima, 149
load(mnewton)$y(d):=?encode\-universal\-time(0,0,0,d[4],d[3],d[2])/31536000$mnewton(f[1][1]+sum(f[i][1]*(1+r)^(y(f[1])-y(f[i])),i,2,length(f)),r,.1);

This code has a bug where some payments might be off by 1/24 day (1 hour). This bug happens if your local time zone moves in or out of daylight-saving time. To fix this bug, add ,0 (2 characters) after d[2].
First set f to a list of lists in the form [[flow, year, month, day], ...]. Then paste this code at Maxima's prompt. The answer comes in the form [[r = float]]. If you want the float by itself, use part(%[1][1],2);
Example 1:
(%i150) f : [[-1, 2001, 1, 1], [.3, 2002, 1, 1], [.4, 2005, 1, 1],
             [.5, 2005, 1, 10]]$

(%i151) load(mnewton)$y(d):=?encode\-universal\-time(0,0,0,d[4],d[3],d[2])/31536000$mnewton(sum(f[i][1]*(1+r)^(y(f[1])-y(f[i])),i,1,length(f)),r,.1);
(%o153)                   [[r = .058394251994029284]]

Example 2:
(%i154) f : [[-1, 2011, 1, 1], [-.3, 2012, 2, 1], [.4, 2015, 3, 1],
             [.01, 2015, 3, 15], [.8, 2015, 4, 10]]$

(%i155) load(mnewton)$y(d):=?encode\-universal\-time(0,0,0,d[4],d[3],d[2])/31536000$mnewton(sum(f[i][1]*(1+r)^(y(f[1])-y(f[i])),i,1,length(f)),r,.1);
(%o157)                  [[r = - .017843072768412977]]

Example 3:
(%i158) f : [[-1, 2011, 1, 1], [3.3, 2012, 2, 1], [5.4, 2015, 3, 1],
             [6.01, 2015, 3, 15], [17.8, 2015, 4, 10]]$

(%i159) load(mnewton)$y(d):=?encode\-universal\-time(0,0,0,d[4],d[3],d[2])/31536000$mnewton(sum(f[i][1]*(1+r)^(y(f[1])-y(f[i])),i,1,length(f)),r,.1);
(%o161)                   [[r = 2.4823712861605407]]

My time zone is America/New_York. Because of the daylight-saving bug, other time zones might give slightly different answers.
Ungolfed
load(mnewton)$

/*
Returns the number of 365-day periods since the epoch, when called as
year([year, month, day]).
*/
year(date):=
?encode\-universal\-time(
  /* s, m, h, day, month, year, time zone */
  0, 0, 0, date[3], date[2], date[1], 0) /
31536000 /* seconds in 365 days */$

/*
Finds a numerical approximation for the internal rate of return for a
list of cash flows on a list of dates.  The dates must be a list of
lists in the form

    [[year, month, day], [year, month, day], ...]

The first date in the list is the present date for calculating the
present value of each cash flow.  Returns the rate for each 365-day
period.
*/
xirr(flows, dates):=
part(
  /* Solve for rate where net present value = 0. */
  mnewton(
    sum(
      /* present value of flows[i] on dates[i] */
      flows[i] * (1 + rate)^(year(dates[1]) - year(dates[i])),
      i, 1, length(flows)),
    rate  /* solve for rate */,
    .1    /* initial guess */)
  [1][1], /* extract 1st solution, 1st variable */
  2       /* value in variable = value */)$

Here xirr(flows, dates) is a function, but the golfed version only has an expression that looks at f.  The golfed version also removes the part call and adds the daylight-saving bug.


text:
Find max sequence length
Assume we have a string, and we want to find the maximum repeated sequence of every letter.
For example, given the sample input:
"acbaabbbaaaaacc"

Output for the sample input can be:
a=5
c=2
b=3

Rules:

Your code can be function or a program - for you to choose
Input can be by stdin, file or function parameter
The output should contain only characters that appear in the input
Input max length is 1024
The output order does not matter, but it has to be printed in the form [char]=[maximum repeated sequence][delimiter]
The string can contain any character

The competition ends on Thursday 3rd at 23:59 UTC.

Is there a maximum to the length of the input string?

Does the output have to be exactly as given? Can we say 0 for letters that don't appear? Will every letter up to the highest letter appear at least once?

Please clarify if the output has to be formatted exactly as exemplified in your question. At least 10 of the current 16 answers use a different format, three others present two different versions.

Does You'r string contain only letters or it may have some special character and numbers.

shall program handle \0 character as normal character?

I had this exact problem in a lab in first year of college :). Except not code golf

@Cruncher: Back when I graded homework in uni I wouldn't have punished anyone for golfing ;-) (but Pascal doesn't golf that well)

@Joey You probably should punish for golfing. By you condoning it, I'm going to end up seeing l:S_&{'=L{2$+_S\#)}g,(N}/ in production systems! And I will curse your name.

Does this count? :) http://www.wolframalpha.com/input/?i=char+%22acbaabbbaaaaacc%22+frequency

8086 machine code, 82 80
Contents of the x.com file:
B7 3D 89 DF B1 80 F3 AA 0D 0A 24 B4 01 CD 21 42
38 D8 74 F7 38 17 77 02 88 17 88 C3 31 D2 3C 0D
75 E9 BF 21 3D B1 5E 31 C0 F3 AE E3 EE 4F BB 04
01 8A 05 D4 0A 86 E0 0D 30 30 89 47 02 3C 30 77
04 88 67 03 43 89 3F 89 DA B4 09 CD 21 47 EB D7

It only supports repetitions of up to 99 characters.
Source code (served as input for the debug.com assembler), with comments!
a
    mov bh, 3d         ; storage of 128 bytes at address 3d00
    mov di, bx
    mov cl, 80
    rep stosb          ; zero the array
    db 0d 0a 24
; 10b
    mov ah, 1
    int 21             ; input a char
    inc dx             ; calculate the run length
    cmp al, bl         ; is it a repeated character?
    je  10b
    cmp [bx], dl       ; is the new run length greater than previous?
    ja  11a
    mov [bx], dl       ; store the new run length
; 11a
    mov bl, al         ; remember current repeating character
    xor dx, dx         ; initialize run length to 0
    cmp al, d          ; end of input?
    jne 10b            ; no - repeat
    mov di, 3d21       ; start printing run lengths with char 21
    mov cl, 5e         ; num of iterations = num of printable characters
; 127
    xor ax, ax
    repe scasb         ; look for a nonzero run length
    jcxz 11b           ; no nonzero length - exit
    dec di
    mov bx, 104        ; address of output string
    mov al, [di]       ; read the run length
    aam                ; convert to decimal
    xchg al, ah
    or  ax, 3030
    mov [bx+2], ax
    cmp al, 30         ; was it less than 10?
    ja  145
    mov [bx+3], ah     ; output only one digit
    inc bx             ; adjust for shorter string
; 145
    mov [bx], di       ; store "x=" into output string
    mov dx, bx         ; print it
    mov ah, 9
    int 21
    inc di
    jmp 127            ; repeat
; 150

rcx 50
n my.com
w
q

Here are some golfing techniques used here that I think were fun:

array's address is 3d00, where 3d is the ascii-code for =. This way, the address for array's entry for character x is 3d78. When interpreted as a 2-character string, it's x=.
Output buffer is at address 104; it overwrites initialization code that is no longer needed. End-of-line sequence 0D 0A 24 is executed as harmless code.
The aam instruction here doesn't provide any golfing, though it could...
Writing the number twice, first assuming it's greater than 10, and then correcting if it's smaller.
Exit instruction is at an obscure address 11b, which contains the needed machine code C3 by luck.

Interesting approach. However, with a limitation of 99 repetitions, it wouldn't handle cases where the input of 1024 aaaa's is supplied.

CJam, 27 26 25 bytes
l:S_&{'=L{2$+_S\#)}g,(N}/

Try it online.
Example
$ cjam maxseq.cjam <<< "acbaabbbaaaaacc"
a=5
c=2
b=3

How it works
l:S       " Read one line from STDIN and store the result in “S”.                   ";
_&        " Intersect the string with itself to remove duplicate characters.        ";
{         " For each unique character “C” in “S”:                                   ";
  '=L     " Push '=' and ''.                                                        ";
  {       "                                                                         ";
    2$+_  " Append “C” and duplicate.                                               ";
    S\#)  " Get the index of the modified string in “S” and increment it.           ";
  }g      " If the result is positive, there is a match; repeat the loop.           ";
  ,       " Retrieve the length of the string.                                      ";
  (       " Decrement to obtain the highest value that did result in a match.       ";
  N       " Push a linefeed.                                                        ";
}/        "                                                                         ";

J - 52 bytes
Well, a simple approach again.
f=:([,'=',m=:":@<:@#@[`(]m~[,{.@[)@.(+./@E.))"0 1~~.

Explanation:
f=:([,'=',m=:":@<:@#@[`(]m~[,{.@[)@.(+./@E.))"0 1~~.
                                                 ~~. Create a set of the input and apply it as the left argument to the following.
   ([,'=',m=:":@<:@#@[`(]m~[,{.@[)@.(+./@E.))"0 1    The function that does the work
                                             "0 1    Apply every element from the left argument (letters) with the whole right argument (text).
                                  @.(+./@E.)         Check if the left string is in right string.
                       (]m~[,{.@[)                   If yes, add one letter to the left string and recurse.
             ":@<:@#@[                               If not, return (length of the left string - 1), stringified.
    [,'=',                                           Append it to the letter + '='

Example:
   f 'acbaabbbaaaaacc'
a=5
c=2
b=3
   f 'aaaabaa'
a=4
b=1

If free-form output is allowed (as in many other answers), I have a 45 bytes version too. These boxes represent a list of boxes (yes, they're printed like that, although SE's line-height breaks them).
   f=:([;m=:<:@#@[`(]m~[,{.@[)@.(+./@E.))"0 1~~.
   f 'acbaabbbaaaaacc'
┌─┬─┐
│a│5│
├─┼─┤
│c│2│
├─┼─┤
│b│3│
└─┴─┘
   f 'aaaabaabba'
┌─┬─┐
│a│4│
├─┼─┤
│b│2│
└─┴─┘

Ruby, 72
(a=$*[0]).chars.uniq.map{|b|puts [b,a.scan(/#{b}+/).map(&:size).max]*?=}

This takes input from command line arguments and outputs to stdout.

chars is a bit shorter than split("").

@Ventero I tried that, but chars gives an enumerator rather than an array. I am in 1.9.3, so is it a 2.0 thing?

Yeah, in 2.0 chars returns an array.

It may be stretching the rules a bit, but perhaps use p instead of puts?

Why not take input from stdin? gets is shorter than $*[0] . Besides you can then skip the assignment to a and use $_ instead. Should save you at least 4 chars in total.

@daniero the problem is that gets inserts a line break at the end of the input which is counted as a character.

I see. Although that makes it less pretty, I can't see that it would break any rules tho.

GolfScript, 26 bytes
:s.&{61{2$=}s%1,/$-1=,n+}%

Try it online.
Explanation:

:s saves the input string in the variable s for later use.
.& extracts the unique characters in the input, which the rest of the code in the { }% loop then iterates over.
61 pushes the number 61 (ASCII code for an equals sign) on top of the current character on the stack, to act as an output delimiter.
{2$=}s% takes the string s and replaces its characters with a 1 if they equal the current character being iterated over, or 0 if they don't.  (It also leaves the current character on the stack for output.)
1,/ takes this string of ones and zeros, and splits it at zeros.
$ sorts the resulting substrings, -1= extracts the last substring (which, since they all consist of repetitions of the same character, is the longest), and , returns the length of this substring.
n+ stringifies the length and appends a newline to it.

Ps. If the equals signs in the output are optional, the 61 can be omitted (and the 2$ replaced by 1$), for a total length of 24 bytes:
:s.&{{1$=}s%1,/$-1=,n+}%

You can save the swap if you push the 61 first: :s.&{61{2$=}s%1,/$-1=,n+}%.

CoffeeScript, 109 bytes
I like regex.
f=(s)->a={};a[t[0]]=t.length for t in s.match(/((.)\2*)(?!.*\1)/g).reverse();(k+'='+v for k,v of a).join '\n'

Here is the compiled JavaScript you can try in your browser's console
f = function(s) {
  var a, t, _i, _len, _ref;
  a = {};
  _ref = s.match(/((.)\2*)(?!.*\1)/g).reverse();
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    t = _ref[_i];
    a[t[0]] = t.length;
  }
  return a;
};

Then you can call
f("acbaabbbaaaaacc")

to get
c=2
a=5
b=3

This seems to generate incorrect results for input like aaaabaa.

@Ventero you're right, there are two problems. one is easily fixed, but I need to think about the other.

@Ventero fixed.

Python 3, 69 bytes
s=input()
for c in set(s):
 i=0
 while-~i*c in s:i+=1
 print(c,'=',i)

Try it online!
Even golfed Python can be very readable. I think this code is fully idiomatic except for the -~i for i+1 and the single-letter variables. Thanks to pxeger for saving 1 byte.
Example runs:
>>> helloworld
e = 1
d = 1
h = 1
l = 2
o = 1
r = 1
w = 1
>>> acbaabbbaaaaacc
a = 5
c = 2
b = 3

This is an interesting solution

if you change set(s) to just s I think it still meets the requirements. Nowhere does it say each char must be printed only once.

@Cruncher I agree the OP doesn't specify each letter once, but the other Python answers seem to assume it, so I'll stick with that to be comparable. Though output formats are still inconsistent. I do wish the OP had responded to the requests to clarify.

You can change for c in set(s) to for c in{*s} for -2 bytes

@cairdcoinheringaahing It looks like this answer actually predates the introduction of set unpacking in Python 3.5, so I'll keep it as is.

69 bytes: Try it online!

Pyth, 24 25 26 (or 29)
=ZwFY{Z=bkW'bZ~bY)p(Yltb

Test can be done here: link
Outputs in the format:
('a', 5)
('c', 2)
('b', 3)

Explanation:
=Zw              Store one line of stdin in Z
FY{Z             For Y in set(Z):
=bk              b=''
W'bZ             while b in Z:
~bY              b+=Y
)                end while
p(Yltb           print (Y, len(b)-1)

Python:
k=""
Z=copy(input())
for Y in set(Z):
 b=copy(k)
 while (b in Z):
  b+=Y
 print(_tuple(Y,len(tail(b))))

For proper (a=5) output, use:
=ZwFY{Z=bkW'bZ~bY)p++Y"="`ltb

29 characters

Seems like you had the exact same idea. Have a +1 for that.

@TheRare yeah, it seems like a very good way to do it.

Not really related to your algorithm, but the python output is confusing, because k='' is defined elsewhere.

Yeah, sorry about that. I'll work on improving it. I'll edit it too.

C, 126 125 119 bytes
l,n,c[256];main(p){while(~(p=getchar()))n*=p==l,c[l=p]=c[p]>++n?c[p]:n;for(l=256;--l;)c[l]&&printf("%c=%d\n",l,c[l]);}

Running:
$ gcc seq.c 2>& /dev/null
$ echo -n 'acbaabbbaaaaacc' | ./a.out
c=2
b=3
a=5

You could replace getchar()>0 by ~getchar() like in this answer

@anatolyg Is EOF guaranteed to be exactly -1? I thought it was only specifically defined as being <0.

I think -1 is common enough (i.e. Windows and linux) so you can assume it for Code Golf. For production code, less than zero is perfectly OK, but == EOF is more clear.

@anatolyg Sure, and actually I guess per the spec EOF apparently isn't even guaranteed to be <0 - it could also be, for example, 256. So I'll just save the single byte. :)

EOF is guaranteed to be negative, and -1 is used even if char is signed; see here

@anatolyg Thanks! That bit was vague from the resources I could find online, so it's good to know the actual spec section. Also, I've put in way more sequence point abuse to cut it down even more. :)

Mathematica, 74 72 69
Print[#[[1,1]],"=",Max[Tr/@(#^0)]]&/@Split@Characters@#~GatherBy~Max&

% @ "acbaabbbaaaaacc"

a=5
c=2
b=3

Not very good but strings are not Mathematica's best area.  Getting better though. :-)

This is pretty impressive golfing (saying this after having tried it myself ...)

v10, not a full solution: First@*MaximalBy[Length] /@ GroupBy[First]@Split@Characters[#] &  At least it's pretty straightforward and readable.

@Szabolcs Thanks!  What's the difference between GroupBy and GatherBy?

The main difference is that GroupBy returns an Association.  I haven't studied the other differences in detail yet.  http://reference.wolfram.com/language/ref/GroupBy.html  You can try it in the cloud with a free account (that's how I'm playing with these).

C# (LinQPad)
146
This is tsavino's answer but shorter. Here, I used Distinct() instead of GroupBy(c=>c). Also the curly braces from the foreach-loop are left out:
void v(string i){foreach(var c in i.Distinct())Console.WriteLine(c+"="+(from Match m in Regex.Matches(i,"["+c+"]+")select m.Value.Length).Max());}

136
I tried using a lambda expression instead of the normal query syntax but since I needed a Cast<Match> first, the code became 1 character longer... Anyhow, since it can be executed in LinQPad, you can use Dump() instead of Console.WriteLine():
void v(string i){foreach(var c in i.Distinct())(c+"="+(from Match m in Regex.Matches(i,"["+c+"]+")select m.Value.Length).Max()).Dump();}

Further study of the code got me thinking about the Max(). This function also accepts a Func. This way I could skip the Select part when using the lambda epxression:
void v(string i){foreach(var c in i.Distinct())(c+"="+Regex.Matches(i,"["+c+"]+").Cast<Match>().Max(m=>m.Value.Length)).Dump();}

Thus, final result:
128
Update:
Thanks to the tip from Dan Puzey, I was able to save another 6 characters:
void v(string i){i.Distinct().Select(c=>c+"="+Regex.Matches(i,"["+c+"]+").Cast<Match>().Max(m=>m.Value.Length)).Dump();}

Length:
122

Thank you for your improvements, I didn't know about the trick with the .Dump() in LinqPad. To be honest, I developed the code in Visual Studio and copied it to LinqPad to save some characters because LinqPad doesn't need a main method.

Thanks! I also just got to know the Dump() method recently, saves you 10+ chars every time :) The curly braces was easy and the rest was a bit of braincracking :D

If you're happy to use LinqPad's IEnumerable display style you can save another 8 chars, with this as your body: i.Distinct().Select(c=>c+"="+Regex.Matches(i,"["+c+"]+").Cast<Match>().Max(m=>m.Value.Length)).Dump();

Ruby, 58
h={}
gets.scan(/(.)\1*/){h[$1]=[h[$1]||0,$&.size].max}
p h

Takes input from STDIN, outputs it to STDOUT in the form {"a"=>5, "c"=>2, "b"=>3}

C# in LINQPad - 159 Bytes
Well, at least I beat T-SQL ;P Won't beat anyone else, but I thought I'd share it anyway.
void v(string i){foreach(var c in i.GroupBy(c=>c)){Console.WriteLine(c.Key+"="+(from Match m in Regex.Matches(i,"["+c.Key+"]+")select m.Value.Length).Max());}}

Usage:
v("acbaabbbaaaaacc");

Suggestions are always welcome!

Great answer! I've got some suggestions but that was too long for a comment so click here for my answer. :)

Powershell 80 77 72
$x=$args;[char[]]"$x"|sort -u|%{"$_="+($x-split"[^$_]"|sort)[-1].length}

You need to run it on console...

$x is superfluous. You're three byte shorter not using it. Also sort -u suffices. There is rarely a need of spelling out the complete parameter names. This will, however, fail for certain characters due to the unescaped use in the regex. Depending on how »The string can contain any character« is to be understood, this could be a problem.

@Joey thanks for the tip on sort -u, however regarding the $x I couldn't get it to work like [char[]]"$args"|sort -u|%{"$_="+($args-split"[^$_]"|sort)[-1].length}, it seems the second $args comes empty... –  darkajax 17 mins ago

Eep, yes. Sorry. That's because it's in a script block, which has its own arguments (the $args there is no longer the one of the script).

Perl - 65 71 76 characters
My first code golf!
For each answer, copy to golf.pl and run as:
echo acbaabbbaaaaacc | perl golf.pl

My shortest solution prints each character as many times as it appears, since that is not prohibited by the rules.
$_=$i=<>;for(/./g){$l=length((sort$i=~/$_*/g)[-1]);print"$_=$l
"}

My next-shortest solution (85 90 characters) only prints each character once:
<>=~s/((.)\2*)(?{$l=length$1;$h{$2}=$l if$l>$h{$2}})//rg;print"$_=$h{$_}
"for keys %h

F# - 106
let f s=
 let m=ref(Map.ofList[for c in 'a'..'z'->c,0])
 String.iter(fun c->m:=(!m).Add(c,(!m).[c]+1))s;m

In FSI, calling
f "acbaabbbaaaaacc"

gives
val it : Map<char,int> ref =
  {contents =
    map
      [('a', 8); ('b', 4); ('c', 3); ('d', 0); ('e', 0); ('f', 0); ('g', 0);
       ('h', 0); ('i', 0); ...];}

However, to print it without the extra information, call it like this:
f "acbaabbbaaaaacc" |> (!) |> Map.filter (fun _ n -> n > 0)

which gives
val it : Map<char,int> = map [('a', 8); ('b', 4); ('c', 3)]

T-SQL (2012) 189 171
Edit: removed ORDER BY because rules allow any output order.
Takes input from a CHAR variable, @a, and uses a recursive CTE to create a row for each character in the string and figures out sequential occurrences.
After that, it's a simple SELECT and GROUP BY with consideration for the order of the output.
Try it out on SQL Fiddle.
WITH x AS(
    SELECT @a i,''c,''d,0r,1n
    UNION ALL
    SELECT i,SUBSTRING(i,n,1),c,IIF(d=c,r+1,1),n+1
    FROM x
    WHERE n<LEN(i)+2
)
SELECT d+'='+LTRIM(MAX(r))
FROM x
WHERE n>2
GROUP BY d

Assigning the variable:
DECLARE @a CHAR(99) = 'acbaabbbaaaaacc';

Sample output:
a=5
c=2
b=3

I don't think I've seen a SQL solution here before. Interesting.

consider the str, function instead of ltrim. You can also name your variable @ to save a char. This allows you to lose the i variable in the rcte. I think you can shave quite a few chars that way. You might also be able to rewrite the query with using a windowing function like sum over rows preceding or lag. I haven't quite formed how yet mind you.

@MichaelB thanks for the advice. The trouble I have with str() is that it outputs a bunch of extra spaces. I will definitely start using @ as a variable!

It's true that str always outputs 10 characters, but this is golfing :P

Haskell - 113 120 bytes
import Data.List
main=interact$show.map(\s@(c:_)->(c,length s)).sort.nubBy(\(a:_)(b:_)->a==b).reverse.sort.group

Tested with
$ printf "acbaabbbaaaaacc" | ./sl
[('a',5),('b',3),('c',2)]

You can use the . (compose) function to avoid creating a lambda where the parameter only appears after the end of a chain of $ connected functions. To do this, simply change all the $s to .s (example: (\i->reverse$sort$group i) turns into reverse.sort.group.

Javascript, 116 bytes
y=x=prompt();while(y)r=RegExp(y[0]+'+','g'),alert(y[0]+'='+x.match(r).sort().reverse()[0].length),y=y.replace(r,'')

Sample output:
lollolllollollllollolllooollo
l=4
o=3

acbaabbbaaaaacc
a=5
c=2
b=3

helloworld
h=1
e=1
l=2
o=1
w=1
r=1
d=1

JavaScript - 91
for(i=0,s=(t=prompt()).match(/(.)\1*/g);c=s[i++];)t.match(c+c[0])||alert(c[0]+'='+c.length)

EDIT: My first solution obeys the rules, but it prints several times single char occurrences like abab => a=1,b=1,a=1,b=1 so I came out with this (101 chars), for those not satisfied with my first one:
for(i=0,s=(t=prompt()).match(/((.)\2*)(?!.*\1)/g);c=s[i++];)t.match(c+c[0])||alert(c[0]+'='+c.length)

JavaScript [83 bytes]
prompt().match(/(.)\1*/g).sort().reduce(function(a,b){return a[b[0]]=b.length,a},{})

Run this code in the browser console.
For input "acbaabbbaaaaacc" the console should output "Object {a: 5, b: 3, c: 2}".

Jelly, 12 bytes
ŒriƇṀj”=ʋⱮQY

Try it online!
-2 bytes thanks to Unrelated String!
8 bytes to output as a list of pairs
How it works
ŒriƇṀj”=ʋⱮQY - Main link. Takes a string S on the left
        ʋ    - Group the previous 4 links into a dyad f(S, C):
Œr           -   Run-length encode S
   Ƈ         -   For each sublist in rle(S), keep it if:
  i          -     It contains C
    Ṁ        -   Maximum
                 As all elements are in the form [C, n] for integers n,
                 Python considers the maximum as the greatest n
     j”=     -   Join with "="; Yields [C, "=", n]
          Q  - Get the unique characters of S
         Ɱ   - For each unique character C in S, yield f(C, S)
           Y - Join by newlines and output

I think the Ṫṭ can be removed: Try it online!

@UnrelatedString Of course! The dangers of golfing at 1 in the morning :)

Husk, 18 bytes
mȯJ'=§eo;←osL►Lk←g

Try it online!
11 bytes if we ignore the exact input format and display as a list of pairs instead.

16 bytes: your turn now!

Husk, 16 bytes
mS:(:'=s▲`mg¹#)U

Try it online!
Explanation:
m              U    # for each of the unique elements of the input
 S:                 # prepend the element to
   (:'=       )     # '=' prepended to
        ▲           # the maximum of
             #      # the number of times it occurs in
         `mg¹       # each group of identical items in the input,
       s            # converted into a string

I saw that Razetime had answered this in Husk, so I had to have a go too...

I'm surprised Husk doesn't have any form of run-length encoding

@cairdcoinheringaahing - it doesn't have it as a single builtin command, so g = group on equal adjacent values is the closest we can get...

Bash / GNU core utils (40)
fold -1|uniq -c|sort -k2 -k1r|uniq -f1

Try it online!
Output when input is "acbaabbbaaaaacc":
      5 a
      3 b
      2 c

Explanation:

fold -1 adds a newline after each character
uniq -c counts the number of consecutive identical lines
sort -k2 -k1r sorts the result so as the maximum count for each character comes first
uniq -f1 keeps only the first line for each character

Welcome to Code Golf! Nice first answer.

Thank you @RedwolfPrograms :-)

Python 3, 88 bytes
from re import*;a=input();[(i[0],len(max(i))) for i in(findall(l+"+",a)for l in set(a))]

Outputs in a format of:
[('b', 3), ('c', 2), ('a', 5)]

This doesn't take input, but otherwise looks like a good approach.

Also you're missing an import re or __import__('re') for the findall.

fixed, I forgot I was testing it interactively ;)

Your byte count was different, I saw the discrepancy and fixed that part of the code.  I also changed to byte count, not char count.

Python3 - 111, 126, 115 114 111 bytes
Executable code that will read 1 line (only use lowercase letters a-z)
d={}.fromkeys(map(chr,range(97,123)),0)
for c in input():d[c]+=1
[print("%s=%d"%(p,d[p]))for p in d if d[p]>0]

Edit: Excluded unnecessary output on request from @Therare
The output looks nice
~/codegolf $ python3 maxseq.py
helloworld
l=3
o=2
h=1
e=1
d=1
w=1
r=1

You really should exclude the unnecessary output. (I think)

"fixed" the output

You can remove spaces between braces, numbers and keywords, such as for or if.

I think you've misread the questions. l=2 and o=1 for "helloworld"

You're counting total appearances instead of maximum consecutive appearances.

I do not think I read the question at all! I'll update with a new solution later

Julia, 85
f(s)=(l=0;n=1;a=Dict();[c==l?n+=1:(n>get(a,l,1)&&(a[l]=n);n=1;l=c) for c in s*" "];a)
julia> f("acbaabbbaaaaacc")
{'a'=>5,'c'=>2,'b'=>3}

JavaScript - 141 137 125
I don't like regex :)
function g(a){i=o=[],a=a.split('');for(s=1;i<a.length;){l=a[i++];if(b=l==a[i])s++;if(!b|!i){o[l]=o[l]>s?o[l]:s;s=1}}return o}

Run
console.log(g("acbaabbbaaaaacc"));

outputs
[ c: 2, a: 5, b: 3 ]

Javascript, 109 104 100 98 bytes
function c(s){q=l={};s.split('').map(function(k){q[k]=Math.max(n=k==l?n+1:1,q[l=k]|0)});return q}

Example usage:
console.log(c("aaaaaddfffabbbbdb"))

outputs:
{ a: 5, d: 2, f: 3, b: 4 }

PHP, 104 102 96
<?php function _($s){while($n=$s[$i++]){$a[$n]=max($a[$n],$n!=$s[$i-2]?$v=1:++$v);}print_r($a);}

usage
_('asdaaaadddscc');

printed
Array ( [a] => 4 [s] => 1 [d] => 3 [c] => 2 )

Java 247
import java.util.*;public class a{public static void main(String[]a){Map<Character, Integer> m = new HashMap<>();for(char c:a[0].toCharArray()){Integer v=m.get(c);m.put(c,v==null?1:v+1);}for(char c:m.keySet())System.out.println(c+"="+m.get(c));}}

Does import java.util.*; work in Java?

yes and i paste old code

The OP said it could just be a function/method so you can shorten this to simply the method.

This outputs all occurrences of the character in the String, not the longest substrings consisting of the character. For example, acbaabbbaaaaacc outputs a=8; b=4; c=3 instead of a=5; b=3; c=2.

R (219, 213, 197, 196, 191, 165, 169, 157, 163 characters)
The data.table version added. There was an error in the previous data.table version.
Golfed data.table version (163)
require(data.table);f=function(x){x=strsplit(x,"")[[1]];data.table(x=x,y=cumsum(c(1,x[-1]!=head(x,-1))))[,.N,list(x,y)][order(-N)][!duplicated(x),paste0(x,"=",N)]}

Ungolfed data.table version
require(data.table)
f <- function(x) {
  x <- strsplit(x, "")[[1]]
  data.table(a=x, y=cumsum(c(1, x[-1] != head(x, -1))))[
  , .N, list(a, y)][order(-N)][!duplicated(a), paste0(a, "=", N)]
}

Golfed data.frame version (174)
f=function(x){x=strsplit(x,"")[[1]];d=data.frame(a=x,y=cumsum(c(1,x[-1]!=head(x,-1))));d=aggregate(d$y,d,length);d=d[order(-d$x),];d=d[!duplicated(d$a),];paste0(d$a,"=",d$x)}

Ungolfed data.frame version
f <- function(x) {
  x <- strsplit(x, "")[[1]]
  d <- data.frame(a = x, y = cumsum(c(1, x[-1] != head(x, -1))))
  d <- aggregate(d$y, d, length)
  d <- d[order(-d$x), ]
  d <- d[!duplicated(d$a), ]
  paste0(d$a, "=", d$x)
}

f("acbaabbbaaaaacc")
f("acbaabbbaaaaaccdee")

C 169
Iterates each printable character in ASCII table and counts max from input string.
#define N 128
int c,i,n;
char Y[N],*p;
int main(){gets(Y);
for(c=33;c<127;c++){p=Y;n=0,i=0;while(*p){if(*p==c){i++;}else{n=(i>n)?i:n;i=0;}p++;}
if(n>0) printf("%c=%d\n",c,n);}
}

Have you tested this? It doesn't look like it produces correct output on a lot of strings , and also doesn't meet the spec which says that input can be up to 1024 long... plus, there's a lot of easy golfing techniques that you've missed. :)

JavaScript 116
prompt(x={}).replace(/(.)\1*/g,function(m,l){n=m.length
if(!x[l]||x[l]<n)x[l]=n})
for(k in x)console.log(k+'='+x[k])

Groovy - 80 chars
Based on this clever answer by xnor :
t=args[0];t.toSet().each{i=0;
while(t.contains(it*++i));
println "${it}=${i-1}"}

Output:
$ groovy Golf.groovy abbcccdddd
d=4
b=2
c=3
a=1

Ungolfed:
t=args[0]

t.toSet().each { c ->
    i=0
    s=c

    // repeat the char c with length i
    // e.g. "b", "bb", "bbb", etc
    // stop when we find a length that is not in t:
    // this is the max + 1
    while (t.contains(s)) {
        i++
        s=c*i
    }
    println "${c}=${i-1}"
}

Does that actually count the maximum sequence length? I don't see how that would work correctly for a string like "aabbbbaaaabbbbbba" although I don't know Groovy either.

It works for your example. I've updated the ungolfed version. Note that "a" * 4 == "aaaa" .

Ah, I see how it works now. Clever.

Javascript (E6) 103
A javascript solution that cares about the requested output format.
F=a=>(p=q={},m={},[...a].map(x=>(x!=p&&(q[p=x]=0),m[x]>++q[x]?0:m[x]=q[x])),''+[i+'='+m[i]for(i in m)])

Ungolfed
F=a=>(
  p=q={}, m={},
  [...a].map(
    x=>(
      x!=p && (q[p=x]=0),
      m[x] > ++q[x] ? 0 : m[x] = q[x]
    )
  ),
  '' + [i+'='+m[i] for(i in m)]
)

Test
In Firefox console
console.log(F("aaaaaddfffabbbbdb"))

a=5,d=2,f=3,b=4

It's written in Python, in order to run the code, just call thefunction maxsequence(str). For instance, maxsequence('aaaaaannndmdejlsfnsfsssssnnnnnxxx') or
maxsequence("kdkdkdkdjeeeiwwwnnnmdnnsbjdiiiiiiiiiidndbbcbbccbcvcvdddcjdjdjwwwwwwkkkkxlxllllllll")
def maxsequence(str):

    count = 1 # count if the letters are repeat
    step = 0 # once the next letter changed, step = count.
    countArray = [] # put all the sequence numbers in an array
    lettersArray = [] # put all the repeat letters in an array
    max = 0
    # for calculating the max of the array, it needs two indexes to do that
    indexFirst = 0
    indexNext = 1
    i = 0
    while(i<len(str) and i<=(len(str)-2)):
        if(str[i]==str[i+1]):
            count += 1
            step = count
        else:
            lettersArray.append(str[i])
            step = count
            countArray.append(step)
            count = 1
        i += 1
    countArray.append(step)
    lettersArray.append(str[i])

    while(countArray[indexFirst]>=countArray[indexNext] and indexNext<(len(countArray)-1)):
        indexNext += 1
        if(countArray[indexFirst]<=countArray[indexNext]):
            indexFirst = indexNext
    max = countArray[indexFirst]

    for i in range(len(lettersArray)):
        print lettersArray[i],"=",countArray[i]

    print "The max sequence is:", max
    return max

Note that the question is a [tag:code-golf], and that means that you should write the shortest code possible. You can do this by removing comments, removing whitespace and using one-letter variable names. After doing that, include the character count in your answer. Also, it is a good idea to provide a un-golfed version of your code. The code that you have now is a good example of a un-golfed code.

Thanks for the advice, I misunderstood the goal of this forum.

Scala – 99 as program, 97 as function
Program (reads one line from stdin)
for((k,v)<-"(.)\\1*".r.findAllIn(Console.in.readLine).toSeq.groupBy(_(0)))println(k+"="+v.max.size)

Function:
def f(s:String)=for((k,v)<-"(.)\\1*".r.findAllIn(s).toSeq.groupBy(_(0)))println(k+"="+v.max.size)

Clojure - 105 bytes
I'm learning Clojure at the moment and what would be a better way to do it than golfing? So, here's my second entry to this challenge.
(def f #(apply str(for[c(distinct %)](str c\=(apply max(map count(re-seq(re-pattern(str c\+))%)))"\n"))))

Examples:
=> (f "acbaabbbaaaaacc")
"a=5\nc=2\nb=3\n"
=> (f "aaaabaa")
"a=4\nb=1\n"
=> (println (f "acbaabbbaaaaacc"))
a=5
c=2
b=3

J 45
~.,.'=',.":@({.@>>.//.$&>)@(<;.2~2&(~:/\),1:)

As a verb. Though for using it , you'd need to assign it to a name, eg:
f=:~.,.'=',.":@({.@>>.//.$&>)@(<;.2~2&(~:/\),1:)
f 'acbaabbbaaaaacc'
a=5
c=2
b=3

Short explanation:
                                @(        2&(~:/\),1:): find where neighbors are different
                                   <;.2~              : cut in these places
            (              $&> )                      : get the length of the string in the box
             ({.@>)                                   : get the first letter from the box
                   (>./)/.                            : get the maximum for each unique char
~.,.'=',.":@(                  )                      : Output: letter = stringified value

BACCHUS, 41
'acbaabbbaaaaacc'j:A=·z#:B=($A,$0h:a(·>0.$0,'=',·+)?),$B¨n

I have discounted the actual parameter String.
Explanation
j:A= Transform the String in a block (some sort of array) and stores it in A variable.
·z#:B= Read last value on the stack (the block) and removes al duplicates, storing it in B.
( Open for each
$A,$0h:a counts how many times the current element of the for each is present in A (read as a String) and pushes this value to Stack (this avoid inmediate printing of the value).
( Open if
·>0. is last value is > 0 then
$0,'=',·+ Concatenates current for each element, '=' and last value in stack (that will be printed out)
)? Close if
,$B¨ Close for each indicating the block to loop over (B).
n Indicates that the output must be space separated

Clojure, 107 bytes
#(apply str(for[p(vals(group-by last(partition-by(fn[i]i)%)))](str(ffirst p)\=(apply max(map count p))\,)))

Returns "a=5,c=2,b=3," for the example input. This would have been 89 bytes, returning ([\a 5] [\c 2] [\b 3]):
#(for[p(vals(group-by last(partition-by(fn[i]i)%)))][(ffirst p)(apply max(map count p))])

APL (Dyalog), 41 bytes
{(⊃,'=',⍕∘≢)¨l[∪⍳⍨⊃¨l←n[⍒≢¨n←⍵⊂⍨1,2≠/⍵]]}

Try it online!
Ungolfed:
{
  n←⍵⊂⍨1,2≠/⍵
  l←n[⍒≢¨n]
  (⊃,'=',⍕∘≢)¨l[∪⍳⍨⊃¨l]
}

{ anonymous function
 2≠/⍵ pair-wise sliding window inequality of the argument
 1, prepend a one
 ⍵⊂⍨ use that to partition the argument
 n← store in n
 n[…] index n with:
  ⍒ the descending order of
  ≢¨ the length of each element in
  ⍵ argument
 l← store in l
 l[…] index l with:
  ∪ the unique of
  ⍳⍨ the first occurrence of each element of
  ⊃¨l the first element of each of l
 (…)¨ apply the following tacit function on each element
  ⊃ the first element
  , concatenated to
  '=' an equal sign
  , concatenated to
  ⍕∘≢ the formatted length
}

05AB1E, 17 bytes
ÙvIγʒyå}€gZy…ÿ=ÿ,

Try it online!
ÙvIγʒyå}€gZy…ÿ=ÿ,   Argument s
Ùv                  For each c in s uniquified
  Iγ                Split s into chunks of consecutive equal elements
    ʒyå}            Filter: Keep elements that contain c
        €g          Map to element length
          Z         Get max
           y…ÿ=ÿ,   Print "c=max"

Java, 192 bytes
import java.util.*;s->{int p=0,c=0;Map<Character,Integer>m=new HashMap();for(byte b:s.getBytes()){c=p==b?c+1:1;m.merge((char)(p=b),c,Math::max);}m.forEach((k,v)->System.out.println(k+"="+v));}

Try it online!
Java, 251 bytes (with regular expressions)
import java.util.regex.*;import java.util.function.*;s->{Matcher m=Pattern.compile("(.)\\1*").matcher(s);Map<String,Integer>a=new HashMap();while(m.find())a.merge(m.group(1),m.group().length(),Math::max);a.forEach((k,v)->System.out.println(k+'='+v));}

Try it online!

Java Code:
Out of interest I just found a solution will further enhance soon.
import java.util.HashMap;

import java.util.Map.Entry;
import java.util.Scanner;
public class MaxSequenceLength {
    private HashMap characterCount = new HashMap<>();
public static void main(String[] args) {
    Scanner inputScanner = new Scanner(System.in);
    new MaxSequenceLength().validateInput(inputScanner.nextLine());
    inputScanner.close();
}

private void validateInput(String inputString) {
    if (inputString.length() <= 1024) {
        scanInput(inputString.toCharArray());
    }
}

private void scanInput(char[] characterArrayInput) {
    for (char tempCharacter : characterArrayInput) {
        if ((int) tempCharacter < 65
                || ((int) tempCharacter > 90 && (int) tempCharacter < 97)
                || (int) tempCharacter > 122) {
            continue;
        } else if (characterCount.containsKey(tempCharacter)) {
            characterCount.put(tempCharacter,
                    characterCount.get(tempCharacter) + 1);
        } else {
            characterCount.put(tempCharacter, 1);
        }
    }
    for (Entry<Character, Integer> tempEntry : characterCount.entrySet()) {
        System.out.println(tempEntry.getKey() + " = "
                + tempEntry.getValue());
    }
}

}
The code would ignore all the other symbols and give only case sensitive character output.

This is a code-golf question, which means you should try to use the least number of characters to solve the problem.

Python (62 55)
n=raw_input()
print map(lambda x:[x,n.count(x)],set(n))

Old answer:
n=raw_input()
s=set(n)
print zip(s,map(lambda x:[x,n.count(x)],s))

You should output the maximum sequence length foe each character, not the count of each character. aaaabaa -> a=4 b=1

oh, well I'll leave this here as an example of how not to read a question!

You can edit your answer with a correct answer, if you wish. Otherwise I would recommend either making it a Community Wiki or deleting it, so you won't lose reputation from the most likely incoming downvotes.

The map/lambda idiom map(lambda x:expression_in(x),list) is longer that the equivalent comprehension [expression_in(x)for x in list].

Oh cool thanks, but that returns a generator object, so to output it all you'd have to do: n=raw_input() for i in ((x,n.count(x))for x in set(n)):print i which is longer, unless I've missed something

I was thinking print[(x,n.count(x))for x in set(n))] or (for Python 3) [print(x,n.count(x))for x in set(n))].

Oh wow, thanks! That is clever

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

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


text:
Find a binary tree's deepest node
Write a program that takes a binary tree as input, and outputs the deepest node and its depth. If there is a tie, print all involved nodes as well as their depths. Each node is represented as:
T(x,x)
T(x)
T
where T is the identifier of one or more alphanumeric characters and each x is another node.
Here's a simple definition of a binary tree:

At the head of a binary tree is a node.
A node in a binary tree has at most two children.

For example, the input A(B(C,D(E))) (below) would output 3:E.

While the following tree is a three-way tie between 5, 11, and 4, and their depth is also 3 (starting from 0):
The input 2(7(2,6(5,11)),5(9(4))) (below) would output 3:5,11,4.

This is code golf, so the shortest code measured in bytes wins.

@close-voter: what are you unclear about?

Perhaps the fact that there is no input or output specification, or test cases for those inputs and outputs.

Trying to fix it but my phone sucks... :P it is better so for though.

Shouldn't the first tree be A(B(C,D(E))?

@bakerg right, my mistake. Fixed.

What is a legal identifier? The spec doesn't seem to rule out identifiers which contain parentheses and commas, so the grammar is ambiguous.

The nodes or the values of the nodes?

@PeterTaylor thanks, restricted to one or more alphanumeric characters.

@AdamSpeight the nodes in this case do not have values; they only have an identifier. So the identifier.

@Jwosty If the question was return the nodes at depth 2 {2;6;9} would be the value but the nodes would be {2; 6(5,11); 9(4,)}. Cos 6 and 11 have sub nodes. So return the nodes isn't the same as, return the value of the nodes.

CJam, 49 47
0q')/{'(/):U;,+:TW>{T:W];}*TW={U]',*}*T(}/;W':@

0                 " Push 0 ";
q                 " Read the whole input ";
')/               " Split the input by ')' ";
{                 " For each item ";
  '(/             " Split by '(' ";
  )               " Extract the last item of the array ";
  :U;             " Assign the result to U, and discard it ";
  ,               " Get the array length ";
  +               " Add the top two items of the stack, which are the array length and the number initialized to 0 ";
  :T              " Assign the result to T ";
  W>{             " If T>W, while W is always initialized to -1 ";
    T:W];         " Set T to W, and empty the stack ";
  }*
  TW={            " If T==W ";
    U]',*         " Push U and add a ',' between everything in the stack, if there were more than one ";
  }*
  T(              " Push T and decrease by one ";
}/
;                 " Discard the top item, which should be now -1 ";
W                 " Push W ";
':                " Push ':' ";
@                 " Rotate the 3rd item to the top ";

I've made a slight modification to the output format to make it consistent and less ambiguous, but it shouldn't too much of an inconvenience.

@Jwosty It shouldn't, if this is not code-golf.

Well, this is code-golf... But anyway, nice submission :)

Can you please explain how this works?

@JerryJeremiah Edited.

How on earth does W':@ do Push W and :, and rotate the 3rd item to the top?

@koko I don't think anything has changed when I split them into three lines...

Haskell, 186 bytes
p@(n,s)%(c:z)=maybe((n,s++[c])%z)(\i->p:(n+i,"")%z)$lookup c$zip"),("[-1..1];p%_=[p]
(n,w)&(i,s)|i>n=(i,show i++':':s)|i==n=(n,w++',':s);p&_=p
main=interact$snd.foldl(&)(0,"").((0,"")%)

Full program, takes tree on stdin, produces spec'd output format on stdout:
& echo '2(7(2,6(5,11)),5(9(4)))' | runhaskell 32557-Deepest.hs
3:5,11,4

& echo 'A(B(C,D(E)))' | runhaskell 32557-Deepest.hs
3:E

Guide to the golf'd code (added better names, type signatures, comments, and some subexpressions pulled out and named -- but otherwise the same code; an ungolf'd version wouldn't conflate breaking into nodes with numbering, nor finding deepest with output formatting.):
type Label = String         -- the label on a node
type Node = (Int, Label)    -- the depth of a node, and its label

-- | Break a string into nodes, counting the depth as we go
number :: Node -> String -> [Node]
number node@(n, label) (c:cs) =
    maybe addCharToNode startNewNode $ lookup c adjustTable
  where
    addCharToNode = number (n, label ++ [c]) cs
        -- ^ append current character onto label, and keep numbering rest

    startNewNode adjust = node : number (n + adjust, "") cs
        -- ^ return current node, and the number the rest, adjusting the depth

    adjustTable = zip "),(" [-1..1]
        -- ^ map characters that end node labels onto depth adjustments
        -- Equivalent to [ (')',-1), (',',0), ('(',1) ]

number node _ = [node]      -- default case when there is no more input

-- | Accumulate into the set of deepest nodes, building the formatted output
deepest :: (Int, String) -> Node -> (Int, String)
deepest (m, output) (n, label)
    | n > m     = (n, show n ++ ':' : label)    -- n is deeper tham what we have
    | n == m    = (m, output ++ ',' : label)    -- n is as deep, so add on label
deepest best _ = best                           -- otherwise, not as deep

main' :: IO ()
main' = interact $ getOutput . findDeepest . numberNodes
  where
    numberNodes :: String -> [Node]
    numberNodes = number (0, "")

    findDeepest :: [Node] -> (Int, String)
    findDeepest = foldl deepest (0, "")

    getOutput :: (Int, String) -> String
    getOutput = snd

That code terrifies me.

Expanded explanatory code added! Let the terror make you stronger!!

You deserve a +1 for that.

Oh my god, and I am struggling with lists :P

GolfScript (75 chars)
Not especially competitive, but sufficiently twisted that it has some interest:
{.48<{"'^"\39}*}%','-)](+0.{;.@.@>-\}:^;@:Z~{2$2$={@@.}*;}:^;Z~\-])':'@','*

The code has three phases. Firstly we preprocess the input string:
# In regex terms, this is s/([ -\/])/'^\1'/g
{.48<{"'^"\39}*}%
# Remove all commas
','-
# Rotate the ' which was added after the closing ) to the start
)](+

We've transformed e.g. A(B(C,D(E))) to 'A'^('B'^('C'^'D'^('E'^)''^)''^) . If we assign a suitable block to ^ we can do useful processing by using ~ to eval the string.
Secondly, we find the maximum depth:
0.
# The block we assign to ^ assumes that the stack is
#   max-depth current-depth string
# It discards the string and updates max-depth
{;.@.@>-\}:^;
@:Z~

Finally we select the deepest nodes and build the output:
# The block we assign to ^ assumes that the stack is
#   max-depth current-depth string
# If max-depth == current-depth it pushes the string under them on the stack
# Otherwise it discards the string
{2$2$={@@.}*;}:^;
# Eval
Z~
# The stack now contains
#   value1 ... valuen max-depth 0
# Get a positive value for the depth, collect everything into an array, and pop the depth
\-])
# Final rearranging for the desired output
':'@','*

Perl 5 - 85
Please feel free to edit this post to correct the character count. I use say feature, but I don't know about the flags to make it run correctly without declaring use 5.010;.
$_=$t=<>,$i=0;$t=$_,$i++while s/\w+(\((?R)(,(?R))?\))?/$1/g,/\w/;@x=$t=~/\w+/gs;say"$i:@x"

Demo on ideone
The output is space-separated instead of comma-separated.
The code simply uses recursive regex to remove the root of the trees in the forest, until it is not possible to do so. Then the string before the last will contain all the leaf nodes at the deepest level.
Sample runs
2
0:2

2(3(4(5)),6(7))
3:5

2(7(2,6(5,11)),5(9(4)))
3:5 11 4

1(2(3(4,5),6(7,8)),9(10(11,12),13(14,15)))
3:4 5 7 8 11 12 14 15

VB.net
Function FindDeepest(t$) As String
  Dim f As New List(Of String)
  Dim m = 0
  Dim d = 0
  Dim x = ""
  For Each c In t
    Select Case c
      Case ","
        If d = m Then f.Add(x)
        x = ""
      Case "("
        d += 1
        If d > m Then f.Clear() :
        m = d
        x = ""
      Case ")"
        If d = m Then f.Add(x) : x = ""
        d -= 1
      Case Else
        x += c
    End Select
  Next
  Return m & ":" & String.Join(",", f)
End Function

Assumption: Node Values can not contain ,,(,)

This doesn't seem to be golfed at all. Can't you remove most of that whitespace (I don't know VB)?

Depends some of the whitespace is significant.

Javascript (E6) 120
Iterative version
m=d=0,n=[''];
prompt().split(/,|(\(|\))/).map(e=>e&&(e=='('?m<++d&&(n[m=d]=''):e==')'?d--:n[d]+=' '+e));
alert(m+':'+n[m])

Ungolfed and testable
F= a=> (
    m=d=0,n=[''],
    a.split(/,|(\(|\))/)
    .map(e=>e && (e=='(' ? m < ++d && (n[m=d]='') : e==')' ? d-- : n[d]+=' '+e)),
    m+':'+n[m]
)

Test
In Firefox console:
['A', '2(7(2,6(5,11)),5(9(4)))', 'A(B(C,D(E)))']
.map(x => x + ' --> ' + F(x)).join('\n')

Output

"A --> 0: A
2(7(2,6(5,11)),5(9(4))) --> 3: 5 11 4
A(B(C,D(E))) --> 3: E"


text:
Convert binary search tree into ordered linked list
Write the shortest possible program that turns a binary search tree into an ordered doubly-linked list, by modifying the pointers to the left and the right children of each node.
Arguments: a pointer to the root of the binary tree.
Return value: a pointer to the head of the linked list.
The binary tree node has three fields:

the ordering key, an integer
a pointer to the left child
a pointer to the right child

The pointers should be modified so that "left child" points to the previous node of the list and "right child" points to the next node of the list.

Y̶o̶u̶'̶r̶e̶ ̶n̶o̶t̶ ̶a̶l̶l̶o̶w̶e̶d̶ ̶t̶o̶ ̶c̶r̶e̶a̶t̶e̶/̶a̶l̶l̶o̶c̶a̶t̶e̶ ̶m̶o̶r̶e̶ ̶n̶o̶d̶e̶s̶.
The tree and the list are both ordered increasingly.
You have to write the implementation of the node object.
The tree is not necessarily complete

Example:
input:
   5 <- root
  / \
 2   8
/ \ / \
1 4 6 9

output:
head -> 1-2-4-5-6-8-9
EDIT:
I removed the 1st rule, since people complained it was not possible to do using functional programming languages.

Do we write our own implementation of the binary tree object for our code? Are the characters of that counted?

@xnor Yes, you have to

Are the binary trees complete?

@JoshuaTaylor not necessarily

I dont like the first limit. Thay will disqualify functional style solutions.

Removed rule 1: now it's a totally different challenge

@edc65 I removed it because of what Ray said, I'm not really sure what to do in this situation

You can't please everyone. The original challenge had a nice constraint on memory allocation that pleased me. Now I can copy all the three in new nodes and work on the copy. That said, Ray did post an answer (unlike me) so his opinion has more weight than mine.

Kind of a recursive DFS?

Python: 100
class N:l=r=v=None
def T(p,q=None):
 if not p:return q
 r=p.r=T(p.r,q)
 if r:r.l=p
 return T(p.l,p)

Ungolfed Version
class Node:
    left = right = value = None

def transform(node, next=None):
    """
    node: head node to convert
    next: next node for the tail node to connect
    return: The converted head
    """
    if not node:
        return next
    node.right = transform(node.right, next)
    if node.right:
        node.right.left = node
    return transform(node.left, node)

Instead of returning a (head, tail) pair, in my solution, a next node is passed as argument to the transform function so that it only need to return the head node. This make the code shorter and cleaner.

You could shorten the result further by doing this: def T(p,q=None):  if not p:return q;  p.r=T(p.l,T(p.r,q));  r.l=p;  return r

Javascript 238 (163 not including the input tree declaration/initialization)
Tested in google chrome. To see the result, open the javascript console and traverse any node of the list.
jsfiddle: http://jsfiddle.net/49grd/1/
b={val:5,n1:{val:2,n1:{val:1},n2:{val:4}},n2:{val:8,n1:{val:6},n2:{val:9}}}
o=[]
function r(t){if(t.n1)r(t.n1);o.push(t);if(t.n2)r(t.n2);}
r(b);
for(var i=0;i<o.length;i++){if(o[i-1])o[i].n1=o[i-1];if(o[i+1])o[i].n2=o[i+1];}
console.dir(o[0]);

Ungolfed:
jsfiddle avbailable here:
http://jsfiddle.net/s8PsU/
var binaryTree =
{
    val: 5,
    n1: {
        val: 2,
        n1: { val: 1},
        n2: { val: 4}
    },
    n2: {
        val: 8,
        n1: {val: 6},
        n2: {val: 9}
    }
}

var orderedNodes = []

function traverse(t)
{
if(t.n1)
    traverse(t.n1);
orderedNodes.push(t);
if(t.n2)
    traverse(t.n2);
}
traverse(binaryTree);

for(var i = 0; i < orderedNodes.length; i++)
{
if(orderedNodes[i-1])
    orderedNodes[i].n1 = orderedNodes[i-1];
if(orderedNodes[i+1])
    orderedNodes[i].n2 = orderedNodes[i+1];
}

console.dir(orderedNodes[0]);

Scala - (207/188) Characters
class n(a:n,b:Int,c:n){var l:n=a;var n:Int=b;var r:n=c}def t(r:n):(n,n)=(if(r.l==null)r
else{val y=t(r.l);r.l=y._2;y._2.r=r;y._1},if(r.r==null)r
else{val y=t(r.r);r.r=y._1;y._1.l=r;y._2})
def a(r:n)=t(r)._1

Without the function a wich just gets the head of the list, this are 188 characters.
Idea is: return a tuple wich consist of the most left element of you and your children and the most right element. Also link your left element to the most element of your left children and your right element to the most left element of your right children.
Code for printing the list:
def printN(r:n)=if(r==null)"null" else (r.n + "->" +printN(r.r))

Ungolfed:
class Node(a:n,b:Int,c:n){//our Node Class
   var l:Node=a //left child
   var n:Int=b //data of the node
   var r:Node=c //right cild
}
def traverse(r:Node):(Node,Node)=(//return a pair
        //get smallest known element
        if(r.l==null) r //smallest is identity if left child is null
        else { //sethighest of traverse of left child as left child
           val y=traverse(r.l)
           r.l=y._2 //left child is highest of traverse left child
           y._2.r=r //and right of this is me
           y._1 //return the currently smallest known element (maybe allways the smallest?
        },
        //get highest known element
        if(r.r==null) r //if right is null, current node is the highest known
        else {
           val y=ttraverse(r.r) //traverse right child
           r.r=y._1 //set pointers for list
           y._1.l=r
           y._2 //return most right child of right child
        }
)//end of return pair
def traverseWrapper(r: Node)=t(r)._1 //just return the smallest element

Note that the list is now double linked, it is possible to ignore the back links and save characters (but this is too ugly).
Bring my first and second semester labs back to mind ;-)

C: 79 114
I'm not sure exactly how this is supposed to be scored, so if someone thinks that other parts of my code should be counted as well, please say so.
Here's the function that does the conversion:
t*f(t*n,t*h){static t*p=0;n?f(n->l,h),(p?(n->l=p),p->r=n:(h=n)),p=n,f(n->r,h):0;t*r=h;for(;r->l;r=r->l);return r;}

This is the struct that I use to represent a tree:
typedef struct n {
        int o;
        struct n* l;
        struct n* r;
} t;

You can see the rest of the code that I used to test it here (re-compile it, it uses STDIN). Here's a sample run:
$ ./tree2list < in
Insert nodes to tree:
Tree traversal:
-527
-7
0
2
3
6
8
23
63
conversion done
List traversal:
-527
-7
0
2
3
6
8
23
63

The contents of the file in:
6
8
2
3
0
-7
23
63
-527

I used code from here to help me fix my conversion algorithm.
Edit: I didn't notice that we're supposed to return a pointer to the list, so I still need to fix that. Fixed.

Haskell: 96
In this solution, new nodes are created, which violate the first rule. However, creating new nodes seems unavoidable in pure functional style code.
data N=N Int N N|L
f L=[]
f(N v l r)=f l++v:f r
g _[]=L
g p(x:y)=n where n=N x p$g n y
t=g L .f

Ungolfed Version
data Node = Node Int Node Node | Leaf

flatten :: Node -> [Int]
flatten Leaf = []
flatten (Node value left right) = flatten left ++ [value] ++ flatten right

link :: Node -> [Int] -> Node
link _ [] = Leaf
link prev (x:xs) = node where
    node = Node x prev $ link node xs

transform = link Leaf . flatten

Some code for testing:
toList Leaf = []
toList (Node v l r) = v:toList r

toReverseList' Leaf = []
toReverseList' (Node v l r) = v:toReverseList' l

toReverseList node@(Node v l Leaf) = toReverseList' node
toReverseList (Node v l r) = toReverseList r
toReverseList Leaf = []

t = Node 4 (Node 2 (Node 1 Leaf Leaf) (Node 3 Leaf Leaf)) (Node 5 Leaf Leaf)

main = do
    print $ toList $ transform t
    print $ toReverseList $ transform t