Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge: ``proper quotes''

Name: Anonymous 2008-08-12 20:08

Write a program that takes a text file and converts adirectional quotes into `` and '', i.e.

INPUT:
I turned my head around, with that casual smile all over my face.
"The stuff you said in your intro, how much of it was serious?"
With her arms crossed in front of her chest, lips sealed tight,
Suzumiya Haruhi kept her stern posture, staring right into my eyes.
"What 'stuff in my intro?'"
"The stuff about the aliens and all that."
"Are you an alien?"


OUTPUT:
I turned my head around, with that casual smile all over my face.
``The stuff you said in your intro, how much of it was serious?''
With her arms crossed in front of her chest, lips sealed tight,
Suzumiya Haruhi kept her stern posture, staring right into my eyes.
``What 'stuff in my intro?'''
``The stuff about the aliens and all that.''
``Are you an alien?''


Use whatever language you want. Bonus points for creativity and efficiency.

I'll start:
#include <stdio.h>

char *q[]= {"''", "``"};
main() {
 int c, i=0;
 while((c=getchar())!=EOF) {
  if(c=='"')
   printf("%s",q[i^=1]);
  else
   putchar(c);
 }
}

Name: Anonymous 2011-11-30 12:43

,[                                    ;while (t0 = getc)
                                     
  >[-]<                               ;t1 = 0
  [->+>+<<]>>[-<<+>>]                 ;inc t1 by t0 using t2
  < ----- ----- ----- -----
    ----- ----- ----                  ;t1 = (t1 != 34)
  >+<[                                ;if t1 (using t2 and t3) then
    <.>                                ;print t0
  >-]>[<                              ;else
    >>>                                ;move to t4
    >+<[                               ;if t4 (using t5 and t6) then
      >>>                               ;move to t7
      [-] +++++ +++++ +++++ +++++
          +++++ +++++ +++++ ++++  ..    ;print ''
      <<<                               ;move to t4
      -                                 ;t4 = 0
    >-]>[<                             ;else
      >>>                               ;move to t7
      [-] +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +++++
          +++++ +++++ +++++ +     ..    ;print ``
      <<<                               ;move to t4
      +                                 ;t4 = 1
    >->]<<                             ;end if
    <<<                                ;move to t1
  >->]<<                              ;end if
<,]

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List