Merge lines

Hello
I have a file with

 CAR 23
COLOR 12
CAR 44
COLOR 12
CAR 55
COLOR 20
SIZE BIG
CAR 56
CAR 57
COLOR 11

How can merge the CAR and the COLOR + SIZE (if there are COLOR,SIZE)

CAR 23 COLOR 12
CAR 44 COLOR 12
CAR 55 COLOR 20 SIZE BIG
CAR 56 
CAR 57 COLOR 11

Every line begin in CAR
Thanks
SHARON

awk '/CAR/ && C { print C ; C=$0 ; next } { C=C" "$0; } END { if(C) print C }' inputfile

Or:

 cat inputfile | tr '\n' ' '  | sed 's/ CAR /\nCAR /g; s/ $/\n/' 
sed '
  s/^  *//
  t loop
  :loop
  $b
  N
  s/ *\n *CAR /\
CAR /
  t p
  s/ *\n */ /
  t loop
  :p
  P
  s/.*\n//
  t loop
 ' in_file >out_file

Narrative: Clean leading spaces off the first line, branch to the target to clear the branch flag, create a loop back branch target, exit at EOF printing last line, get a second line into the buffer, if it is a CAR line just clean it up and branch to print first line, remove first line, and loop. If not a CAR line, turn the linefeed and any adjacent spaces into a space and loop. I call this a classic looper in sed, where you merge lines but have to deal with the next group or EOF. Note that a) it assumed the first line is a CAR line, and B) it checks for 'CAR ', not just 'CAR', so as not to be fooled by substrings of other words.

awk ' {
        $1 = $1
        A[++n] = $0
} END {
        for ( i = 1; i <= n; i++ ) {
                if ( A ~ /CAR/ ) {
                        A = ( i == 1 ? A FS : RS A FS )
                        printf A
                }
                else
                {
                        A = ( i == n ? A RS : A FS )
                        printf A
                }
        }
}' filename