Take a break to make a snake! Our classic snake has developed an inbalance of growth hormones. To make matters worse, his tail is frozen in place! Given directional input as specified in Figure 1, write a program to determine where he will grow.



Figure 1. Directional input.

Program specifications


Read the input character by character on STDIN.
After reading a character, output the snake to STDOUT. Please include a blank line in between each time you print a snake.
The snake consists of &lt;&gt;v^ and a head. The head of the snake may be any round character of your choosing, such as o, 0, O, or ☺.
Any combination of wasd is valid for input.
Your program should not assume the input is within a certain length.
The snake can pile on top of itself, overwriting &lt;&gt;v^. See examples for snake growing mechanics.
Trailing whitespace is okay, but your snake must look correct.


Scoring

This is code-golf. Your score is the number of characters in your program. Lowest score wins!

Example snakes:

Input: ddddssaassdddddww

Output:

&gt;&gt;&gt;&gt;v
    v
  v&lt;&lt;  ☺
  v    ^
  &gt;&gt;&gt;&gt;&gt;^




Input: dddsssaaawww

Output:

☺&gt;&gt;v
^  v
^  v
^&lt;&lt;&lt;




Input: dddsssdddddasddddwww

Output:

&gt;&gt;&gt;v
   v       ☺
   v       ^
   &gt;&gt;&gt;&gt;v&lt;  ^
       &gt;&gt;&gt;&gt;^




Input: dddwwdddssssaaaaaaaaawww

Output:

      &gt;&gt;&gt;v
☺     ^  v
^  &gt;&gt;&gt;^  v
^        v
^&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;




Input: ddddssssaawwddddd

Output:

&gt;&gt;&gt;&gt;v
    v
  &gt;&gt;&gt;&gt;&gt;☺
  ^ v
  ^&lt;&lt;




Input: dddddssaawwwwddddd

Output:

   &gt;&gt;&gt;&gt;&gt;☺
   ^
&gt;&gt;&gt;^&gt;v
   ^ v
   ^&lt;&lt;




Input:

ddddaaaasssssdddddddddddwwwwwaaaasssssdddddddddddwwwwwwwwwwsssssaaaasssssdddddddwwwwwddddssaaaasssddddaaaassssssssssdddwwwwwwwddddswaaaassssddaasssaaaaaaaaaawwwwddddssssaaaaaaaaaaawwwwddddsssssssssaaaa


Output:

                  v
                  v
                  v
                  v
                  v
v&lt;&lt;&lt;&lt;  v&lt;&lt;&lt;&lt;  v&lt;&lt;&lt;&lt;  &gt;&gt;&gt;&gt;v
v      v   ^  v   ^  ^   v
v      v   ^  v   ^  v&lt;&lt;&lt;&lt;
v      v   ^  v   ^  v
v      v   ^  v   ^  v
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;v&lt;&lt;&lt;&lt;
                     v
                     v
                     v  v&lt;&lt;&lt;&lt;
                     v  v   ^
                     v  v
       &gt;&gt;&gt;&gt;v  &gt;&gt;&gt;&gt;v  v  v
       ^   v  ^   v  v  v&lt;&lt;
       ^   v  ^   v  v  v
       ^   v  ^   v  v  v
       ^&lt;&lt;&lt;v&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
           v
           v
           v
           v
       O&lt;&lt;&lt;&lt;
ECMAScript 6 Javascript (399 401 431)

Has to be run in a browser supporting ECMAScript 6 due to the arrow functions. 

Here are fiddles which have been altered to run in any (common) browser by not using arrow functions. They also print to a textarea instead:


Normal
Animated


Golfed Version

i=prompt(),v=[],c=0,x=[0],y=[0],s='unshift',k='slice',t='sort',h=[0,-1,0,1,0]
while(c&lt;i.length){m='wasd'.indexOf(i[c++]);v[s]('^&lt;v&gt;'[m]);x[s](x[0]+h[m]);y[s](y[0]+h[m+1])}f=(a,b)=&gt;a-b
q=x[k]()[t](f)[0],e=x[k]()[t]((a,b)=&gt;b-a)[0],w=y[k]()[t](f)[0],o=[]
while((i=y.pop())!=null){i-=w;j=x.pop()-q;t=(o[i]||Array(e+1-q).join(" ")).split("");t.splice(j,1,v.pop()||"@");o[i]=t.join("")}alert(o.join("\n"))


Animated GIF:

One of the OP's examples:



The example from Stretch Maniac:



Ungolfed

Here is a (slightly) ungolfed version from sometime before I started really golfing it down:

var input = prompt(),
    values = [],
    c = 0,
    x = [0],
    y = [0],
    s = 'unshift';
while (c &lt; input.length) {
    var mapped = 'wasd'.indexOf(input[c++]);
    values[s]('^&lt;v&gt;'[mapped]);
    x[s](x[0]+[0, -1, 0, 1][mapped]);
    y[s](y[0]+[-1, 0, 1, 0][mapped]);
}

var minX = x.slice().sort(function (a,b){return a-b})[0];
var maxX = x.slice().sort(function (a,b){return b-a})[0];
var minY = y.slice().sort(function (a,b){return a-b})[0];

var output = [];
while((i=y.pop())!=null) {
    i-=minY;
    j=x.pop()-minX;
    t=(output[i]||Array(maxX+1-minX).join(" ")).split("");
    t.splice(j,1,values.pop()||"@");
    output[i]=t.join("");    
}

console.log(output.join("\n"));