Determine if a string is squeezable: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: removed bogus flagging as all five strings were indeed used, with eight results as per the task's requirements.)
m (→‎{{header|REXX}}: corrected an input data field in the REXX program and it's corresponding output.)
Line 423: Line 423:
#.1= ' '; @.1=
#.1= ' '; @.1=
#.2= '-'; @.2= '"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln '
#.2= '-'; @.2= '"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln '
#.3= '7'; @.3= ..1111111111111111111111111111111111111111111111111111111111111111177788
#.3= '7'; @.3= ..1111111111111111111111111111111111111111111111111111111111111117777888
#.4= . ; @.4= "I never give 'em hell, I just tell the truth, and they think it's hell. "
#.4= . ; @.4= "I never give 'em hell, I just tell the truth, and they think it's hell. "
#.5= ' '; @.5= ' --- Harry S Truman '
#.5= ' '; @.5= ' --- Harry S Truman '
Line 432: Line 432:
say copies('═', 105) /*show a separator line between outputs*/
say copies('═', 105) /*show a separator line between outputs*/
if j>1 & L==0 then leave /*if arg is null and J>1, then leave. */
if j>1 & L==0 then leave /*if arg is null and J>1, then leave. */
say ' specified immediate repeatable chararacter=' #.j " ('"c2x(#.j)"'x)"
say ' specified immediate repeatable character=' #.j " ('"c2x(#.j)"'x)"
say ' length='right(L, 3) " input=«««" || @.j || '»»»'
say ' length='right(L, 3) " input=«««" || @.j || '»»»'
new= squeeze(@.j, #.j)
new= squeeze(@.j, #.j)
Line 452: Line 452:
<pre>
<pre>
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= ('20'x)
specified immediate repeatable character= ('20'x)
length= 0 input=«««»»»
length= 0 input=«««»»»
length= 0 output=«««»»»
length= 0 output=«««»»»
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= - ('2D'x)
specified immediate repeatable character= - ('2D'x)
length= 72 input=«««"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln »»»
length= 72 input=«««"If I were two-faced, would I be wearing this one?" --- Abraham Lincoln »»»
length= 70 output=«««"If I were two-faced, would I be wearing this one?" - Abraham Lincoln »»»
length= 70 output=«««"If I were two-faced, would I be wearing this one?" - Abraham Lincoln »»»
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= 7 ('37'x)
specified immediate repeatable character= 7 ('37'x)
length= 72 input=«««..1111111111111111111111111111111111111111111111111111111111111111177788»»»
length= 72 input=«««..1111111111111111111111111111111111111111111111111111111111111117777888»»»
length= 70 output=«««..11111111111111111111111111111111111111111111111111111111111111111788»»»
length= 69 output=«««..1111111111111111111111111111111111111111111111111111111111111117888»»»
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= . ('2E'x)
specified immediate repeatable character= . ('2E'x)
length= 72 input=«««I never give 'em hell, I just tell the truth, and they think it's hell. »»»
length= 72 input=«««I never give 'em hell, I just tell the truth, and they think it's hell. »»»
length= 72 output=«««I never give 'em hell, I just tell the truth, and they think it's hell. »»»
length= 72 output=«««I never give 'em hell, I just tell the truth, and they think it's hell. »»»
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= ('20'x)
specified immediate repeatable character= ('20'x)
length= 72 input=««« --- Harry S Truman »»»
length= 72 input=««« --- Harry S Truman »»»
length= 20 output=««« --- Harry S Truman »»»
length= 20 output=««« --- Harry S Truman »»»
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= - ('2D'x)
specified immediate repeatable character= - ('2D'x)
length= 72 input=««« --- Harry S Truman »»»
length= 72 input=««« --- Harry S Truman »»»
length= 70 output=««« - Harry S Truman »»»
length= 70 output=««« - Harry S Truman »»»
═════════════════════════════════════════════════════════════════════════════════════════════════════════
═════════════════════════════════════════════════════════════════════════════════════════════════════════
specified immediate repeatable chararacter= r ('72'x)
specified immediate repeatable character= r ('72'x)
length= 72 input=««« --- Harry S Truman »»»
length= 72 input=««« --- Harry S Truman »»»
length= 71 output=««« --- Hary S Truman »»»
length= 71 output=««« --- Hary S Truman »»»