text:
Twisting Words!
Twisting Words!
Given a string and a positive integer. You must twist the string, back and forth.
Example Input / Output
Input
Programming Puzzles & Code Golf
4

Output
Prog
mmar
ing
zzuP
les
oC &
de G
 flo

Input
The input can be taken in through STDIN, or function argument. The input will consist of a string and a positive integer, n. The integer will determine the length of each twisted line.
The string is twisted back-and-forth. An input of HELLO, WORLD! and 5 would look like:

Output
The output will be the twisted text. It may not any trailing whitespace. If the input string length is not divisible be the line length, add a space until the line is filled:
An example of this:
Input
Hello, World!
5

Output (Note the whitespace at the very end)
Hello
roW ,
ld!

Related: a readable implementation at CodeReview

It may not any trailing whitespace. Golfed away a verb?

May we return a list of lines?

While working on this, I was wondering if this was made a bit more challenging. In addition to twisting the words, we should also find patterns that match between two lines. For example, if the word was This pearl was made from the peas and we broke it by 4 chars, then aep  will appear on line 2 and line 8. We need to identify the matches. If there are more than one match, then we need to print all the matches including line number that matched :)

Pyth, 19 15
VPc+z*dQQ_W~!ZN

Pre-pads the string, then reverses each other line as it prints it. The padding is equal to the size of the box, but the last line after chopping up the input is discarded.
Try it here

CJam, 19 bytes
q~1$S*+/W<{(N@Wf%}h

Input example:
5 "Hello, World!"

Explanations
q~         e# Input n and the string.
1$S*+      e# Append n spaces to the string.
/W<        e# Split by each n characters, and remove the last chunk.
{          e# While the array of chunks isn't empty:
    (N     e# Extract the first chunk and push a newline.
    @Wf%   e# Reverse every chunk left in the array.
}h

Python 2, 60
s,n=input()
d=1
while s:print(s+n*' ')[:n][::d];s=s[n:];d=-d

Takes n characters at a time from the from of s, printing them with a direction d that alternates between 1 and -1. For spacing on the last line, s is padded with n spaces at the end before it is chopped, which only affects it when it has fewer than n characters remaining.
A recursive solution would save a char (59) except that it leaves a trailing newline, which is not allowed.
f=lambda s,n,d=1:s and(s+n*' ')[:n][::d]+"\n"+f(s[n:],n,-d)

Snowman 1.0.1, 91 bytes
{vg10vg|sB*#.'aGal'NdE'aaAaL|al!*+#5nS" "'aR'!#aCwR|.aC2aG:0aa|sP"
"sP'NdE|1aA.aNsP"
"sP;aE

Or all on one line (for aesthetics, or more specifically, anti-aesthetics), at the cost of 2 bytes:
{vg10vg|sB*#.'aGal'NdE'aaAaL|al!*+#5nS" "'aR'!#aCwR|.aC2aG:0aa|sP10wRsP'NdE|1aA.aNsP10wRsP;aE

This is way too short, for Snowman. (It's probably the shortest it can get, though; I worked on golfing this for a pretty long time.)
This has one caveat: it will exit with an error (but still produce the correct output) 50% of the time, when the last line is not reversed. (This is because I use ag to group the array elements in groups of two so that I can reverse every other one, but I don't check whether the last element has both expected elements, so it'll try to access a nonexistent element if there are an odd number of lines.)
Ungolfed / explanation:
{vg10vg|sB*#      // get input, convert second string to number and store
.'aG              // split string into groups of n chars
al'NdE'aaAaL      // take out the last element of the array
|al!*+#5nS" "'aR  // subtract its length from 5, repeat that many spaces
'!#aCwR|.aC       // concat spaces to last el. and that back to the array
2aG               // split in groups of 2, so we can reverse every other string
// for each sub-group in the array of groups...
:
    0aa|sP10wRsP         // print the first element as is
    'NdE|1aA.aNsP10wRsP  // print the second element, reversed
;aE

Haskell, 83 75 bytes
(id!)
(f![])_=[]
(f!l)n=f(take n$l++cycle" ")++'\n':((f.reverse)!drop n l)n

Simple chunksOf implementation with take and drop, applying an even or odd number of reverses to the output as we go.
Thanks to @BMO for five bytes and @ØrjanJohansen for three bytes!
Try it online!

Using cycle saves 5 bytes, try it online!

Save three more bytes by removing g and swapping n and l: Try it online!

J, 22 15 13 bytes
]`|."1@(]\)~-

-2 bytes thanks to xash
Note the above solution requires J901, which allows you to apply cyclic gerunds using the rank " conjuntion.  TIO uses an older version, so to run this one you have to download J.
However, my previous solution of 15 bytes will work on TIO:
15 bytes
([]`|.\[:,]\)~-

Try it online!
Finally, another 15 byte alternative, thanks to @Marshall and based on a trick from @ngn, is:
([:|.@]/\]\)~-

Your output seems to be incorrect for the final line of the test case you've used (trailing space instead of leading).

@KevinCruijssen Sadly fixing that one small thing ruined the elegance of the solution (╥﹏╥)

:( You did fix it though, so +1 from me. :)

Stuck, 42 41 40 38 Bytes
This is a wee bit too long, probably will try to golf more!
tg;_lu_@%u;-_0G<*' *+0GKE"];2%;Y_Y?p":

Input should be like "string"|n.
Explanation:
tg                 # Take input, place each item on stack, save the int to variable stack
;_l                # Swap the top two items, duplicate the string and obtain length
u_@%               # Rotate to the left, duplicate, rotate right and take mod
u;-                # Rotate left, swap the top two and subtract from each other
_0G<*              # duplicate this value, check if less than stored int and multiply
' *+               # Push space onto stack n times, append to starting string
0GKE               # Split this string into segments, and enumerate
"];2%;Y_Y?p":      # For each segment, determine if should be reversed, and print

APL (Dyalog Unicode), 19 bytes
{↑⊢∘⌽\↓↑⍵⊆⍨⌈⍺÷⍨⍳≢⍵}

Try it online!
Took the ⊢∘⌽\ trick from ngn's brilliant answer to the boustrophedonise challenge.
After realising that my submission breaks for lines with leading newlines, I have added two more bytes. Below is the older submission.
APL (Dyalog Unicode), 17 bytes
{↑⊢∘⌽\⍵⊆⍨⌈⍺÷⍨⍳≢⍵}

Try it online!

Perl, 87 bytes
sub f{$_=@_[0].$"x(@_[1]-1);$a.=(($i++&1?reverse$1:$1).$/)while/(.{@_[1]})/g;chop$a;$a}

Old version (prints a trailing newline):
sub f{$_=@_[0].$"x(@_[1]-1);print(($i++&1?reverse$1:$1).$/)while/(.{@_[1]})/g}

String is passed as a function argument with no trailing newline. Call like this:
$_=<>;chomp;print f($_,5);

PowerShell, 102 Bytes
param($s,$i)$l=$s.Length;$s+' '*($i%$l)-split"(.{$i})"|?{$_}|%{$r=-not$r;@($_,($_[$l..0]-join''))[$r]}

Invoked as follows (if saved to file CodeGolf55051.ps1)
.\CodeGolf55051.ps1 -s '1234567890' -i 4

Previous Attempts
(longer or invalid)
PowerShell, 110 Bytes
param($s,$i)$l=$s.Length;$s+' '*(($i-$l%$i)%$i)-split"(.{$i})"|?{$_}|%{$r=-not$r;@($_,($_[$l..0]-join''))[$r]}

PowerShell, 111 Bytes
param($s,$i)$s+' '*(($i-$s.Length%$i)%$i)-split"(.{$i})"|?{$_}|%{$r=-not$r;@($_,($_[$_.length..0]-join''))[$r]}

Explanation
param($s,$i)                         #Take input text (s) and column width (i)
$s                                   #take the user entered string
+ ' ' * (($i - $s.Length % $i) % $i) #add the least number of spaces required to make its length divisible by i
-split"(.{$i})"                      #break it into chunks of i characters in length
| ?{$_}                              #skip any blank lines created in the process
| %{                                 #for each line
    $r = -not $r;                    #    toggle a boolean value
    @(                               #    define an array
        $_                           #    index 0 = the string going forwards
        ,($_[$_.length..0] -join '') #    index 1 = the string reversed (by taking each character from the last to the first, then joining them)
    )[$r]                            #    if our boolean value is false take the forward string (index 0), if true take the backwards one (index 1)
}                                    #next

PowerShell, 180 Bytes
param($s,$i)$x="`${0}|{1}|`${2}";$w=$x;1..$i|%{$w=$w-f$_,$x,($i+$_)};$w=$w-replace'\||\${.*}';$r=$w-replace'\$\d+','(.)?';$s+' '*($i-$s.Length%$i)-replace$r,$w-split"(.{$i})"|?{$_}

PowerShell, 196 Bytes
param($s,$i)$x="{0}|{1}|{2}";$w=$x;1..$i|%{$w=$w-f$_,$x,($i+$_)};$w=$w-replace'(\d+)','$$$1'-replace'\||{.*}';$r=$w-replace'\$\d+','(.)?';$s+' '*($i-$s.Length%$i)-replace$r,$w-split"(.{$i})"|?{$_}

Explanation
param ($s, $i)                      #Take input text (s) and column width (i)

$x = "{0}|{1}|{2}"                  #Define string format which takes 3 entries and pipe delimits them

$w = $x                             #initialise our replacement regex with this format
1..$i | %{                          #for 1 to the specified column width
    $w = $w -f $_, $x, ($i + $_)    #update the regex 1|{...}|5, 1|2|{...}|6|5, etc
}                                   #resulting in w = 1|2|3|4|{...}|8|7|6|5
$w = $w -replace '(\d+)', '$$$1'    #now prefix the numbers with a dollar (so they're regex replacement variables)
        -replace '\||{.*}'          #and remove the delimiters and superfluous `{...}` left from our middle insertion routine

$r = $w -replace '\$\d+', '(.)?'    #then create the match pattern by replacing the variables with optional single character captures

$s                                  #now take the user entered string
    + ' ' * ($i - $s.Length % $i)   #add the least number of spaces required to make its length divisible by i
    -replace $r, $w                 #perform a replacement using the regex match and replace patterns created above
    -split "(.{$i})"                #then split the string into blocks of length i
    | ?{$_}                         #removing any blank lines created in the process

({...} in the above comments is actually {0}|{1}|{2}; I put {...} for improved readability.
Powershell, 120 Bytes
(invalid)
param($s,$i)$s + ' ' * ($i-$s.Length%$i) -replace '(.{4})?(.)(.)(.)(.)',"`$1`n`$5`$4`$3`$2`n" -split "`n" | ?{$_ -ne ""}

Awesome to see another PowerShell slinger! An easy start is to get rid of dang near every space param($s,$i)$s+' '*($i-$s.Length%$i)-replace'(.{4})?(.)(.)(.)(.)',"`$1`n`$5`$4`$3`$2`n"-split"`n"|?{$_-ne""}
which will get you down to 108.

Thanks @TimmyD; just spotted a couple of fundamental errors with my script though (it doesn't meet the requirements / is hardcoded to only work for 4... fixing now)

While testing, to get the flow back and forth to start in the correct direction, I needed to swap the final [$r] index with [-not$r] ... else the first line reads the opposite (i.e., right-to-left) than in the examples provided. Otherwise, really slick execution!

Also, since we're given that the input number n is positive, and we're guaranteed that the length of the string is non-negative (by definition), that means that (($i-$l%$i)%i) is equivalent to ($i-$l%$i), saving four characters.

Thanks @TimmyD; though is that true (i.e. I=3;L=6 gives 0 with the original and 3 with the shortened version).

Whoops, I somehow typo'd that, I originally meant (-$l)%$i. Don't know where that came from. Interesting, however, that it's not equivalent, though it should be. It's apparently a quirk of how PowerShell (among other languages) implements the modulo function, which is different than either I (being a math major) or Wolfram-Alpha expected. Apparently, you'll need to stick with the longer version. Reference
Proof --> ((y-x%y)%y) ==> ((y%y)-(x%y%y))%y ==> ((0)-(x%y))%y ==> (-x%y)%y ==> (-x)%y

Mumps, 86 bytes
R I,S,! S P=$L(I),$P(I," ",P)=P F Q=1:S:P S F=$E(I,Q,Q+S-1),P='P W $S('P:F,1:$RE(F)),!

Although it could be 2 bytes shorter if you remove the first ',!' characters in the R statement (read from STDIN); that adds a carriage return between the input and output. If that wasn't there, the output is technically correct, but the first line would appear appended to the input string. [[ The standard Mumps terminal that I use has no local echo. ]]   As it sits, here's the test:
R I,S,! S P=$L(I),$P(I," ",P)=P F Q=1:S:P S F=$E(I,Q,Q+S-1),P='P W $S('P:F,1:$RE(F)),!
ABCDEFGHIJKLMNOPQRSTUVWXYZ1236
ABCDEF
LKJIHG
MNOPQR
XWVUTS
YZ123

Also note, there's actually a carriage return / Enter keypress between the '123' and the '6' at the end of the input. [[ The local echo thing again. ]]
If anyone's interested I can describe what's going on with the code; but I do realize there's not a ton of Mumps enthusiasts out there... :-)

Perl 5, 51 bytes
$_.=$"x(($-=<>)-1);say--$|?$_:~~reverse for/.{$-}/g

Try it online!

Clojure, 83 bytes, 87 bytes, 79 bytes
(fn[n s](map #(apply str(% %2))(cycle[#(or %)reverse])(partition n n(repeat\ )s))))

several corrections after comments below, thank you Ørjan.
Try it online!
Clojure seems often sadly absent from code golfing answers. It certainly can not compete in byte length with golfing languages, but I think the total absence is somewhat unwarranted.
Explanation:

in-data, two arguments a number and a string
start by running clojure built-in function partition on string s chunking it into a sequence of lists of characters where the lists have length n. The last chunk will be padded with spaces to length n using the "pad collection" returned from (repeat " ") which returns an infinite lazy sequence of spaces
we then call map with three arguments:

an anonymous function (the #(..))
an infinite alternating lazy sequence of functions #(or %) which functions like the identity function and reverse (i.e. [#(or %) reverse #(or %) reverse ...]) as returned by cycle.
the chunked up lazy sequence of lists returned by partition.

finally the anonymous function #(apply ...):

calls either identity or reverse alternatingly on a chunk. This is done via the (% %2) expression which calls the function sent in as the first argument to the anonymous function [i.e. identity or reverse] using the second argument [i.e. the chunk] to the anonymous function as the argument to the call.
calls (apply str ...) to convert the list of characters into a string

the outer function returns a lazy sequence of strings

one trick we use here is that a lot of clojure functions like map take an arbitrary number of collections as args, i.e. (map f coll1 coll2 coll3 ...) where the function f just needs to accept as many arguments as there are collections. In this case we send in two collections, a collection of alternating function references and the chunked up string.

This is nice but it doesn't seem to have the required whitespace at the end of ld!  .

You are most correct. Added a pad collection which should fix the issue...and cost me 8 bytes...

I have a question on golfing rules: if you are using a built-in function which would require an import or similar statement (require in clojure, import in java, etc), does the importing of that built-in need to be part of the golfing solution byte count? I assume yes, but it feels a tad like a gray area.

Yes, the import is counted.

Oh but there's another rule you're breaking: You cannot take input in predefined variables, you need to make the solution either a whole program or a function. (Using either fn or defn is fine.) On the flip side your function is allowed to just return the result rather than print it.

I suppose #() is also fine, I don't really know Clojure.

Thanks for the pointers and apologies for noobness with golfing rules. Added function and now return a sequence of strings instead of printing them.

Python 3, 110 108 107 103 bytes
def a(s,n):l=len(s)//n+1;s+=' '*(len(s)-l);print('\n'.join([s[x*n:n*x+n][::(-1)**x]for x in range(l)]))

(looking at other answers), with rjust: 95 93 92 90 bytes
def a(s,n):print('\n'.join([s[x*n:n*x+n][::(-1)**x].rjust(n)for x in range(len(s)//n+1)]))

The last line of your output is wrong. Run it here. It's a great first post, and once you fix that I will suggest some ways to golf some bytes off, the first being that you can remove all the spaces/tabs from your answer.

haha, you're so right. fixing this is gonna cost a lot but i'm on it. thanks

Tips for golfing in Python

Also, you beat my answer from quite a while ago: https://codegolf.stackexchange.com/a/55082/34718

reading the tips. thanks again

Make sure you count your bytes correctly.

i forgot the newline. sorry and thanks for editing

Lua, 91 88 88 84 83 82 bytes
Old version:
a=arg for i=1,#a[1],a[2]do s=a[1]:sub(i,i+a[2]-1)print(d and s:reverse()or s)d=not d end

New version:
arg[1]:gsub((".?"):rep(arg[2]),function(s)print(d and s:reverse()or s)d=not d end)

Haskell, 108 bytes
(#)=splitAt
s!n=let(a,t)=n#s;(b,u)=n#t in a:reverse b:(u!n)
s%n=unlines$takeWhile(any(>' '))$(s++cycle" ")!n

That's sort of long, jeez. Here it is in action:
*Main> putStrLn $ "Programming Puzzles & Code Golf" % 4
Prog
mmar
ing
zzuP
les
oC &
de G
 flo

How does binding the let expression work?

It's a two-in-one let statement separated by a semicolon -- normally you'd use newlines and indentation, but Haskell also allows you to write let a=b; c=d in expr.

I didn't know this was allowed, taking putStrLn out of the program!

@LeifWillerts, recently, challenges on here tend to allow you to either perform I/O via function arguments/results or stdin/stdout -- here, my solution is a function (%) :: String -> String -> String instead of IO ().

Python 2, 109 bytes
Had to add padding with spaces for the last line to be correct.
Try it here
I,c=input()
I+=(c-len(I)%c)*" "
L=[]
i=0
while I:s=I[:c];L+=[[s,s[::-1]][i%2]];i+=1;I=I[c:]
print"\n".join(L)

Q, 64 56 bytes
{c::neg y;-1(til(#)l){$[x mod 2;c$(|:)y;y]}'l:y cut x;}

{} is a function that should be called as {}[x;y].

x will be the string.
y will be the length of the resulting lines.

Test:
{c::neg y;-1(til(#)l){$[x mod 2;c$(|:)y;y]}'l:y cut x;}["Programming Puzzles & Code Golf";4]
Prog
mmar
ing
zzuP
les
oC &
de G
 flo

edit: Used shorter functions as inspired by the other q answer by @tmartin

Python 2, 82 75 bytes
s,n=input()
k=0
while k<=len(s):print s[k:k+n].ljust(n)[::1-2*(k/n%2)];k+=n

I couldn't comment on @willem but I made his code smaller.
Try here
Try here

Hi AlexN, nice one. I think that your last line in the 'Try here' example is not correct. It should be justified right. Also I count 86 chars? See my entry for the update.

Hi willem, you are right, I corrected the code and found that you have an error in yours:
http://ideone.com/GOmMrE
There should be a t on the right side.

O, 60 bytes
z""/rlJ(Q/{n:x;Q({+}dxe{`}{}?p}drQJQ%-{' }dJQ/e{r}{}?Q({o}dp

My very first O program, and a long one at that!
Live demo.

JavaScript ES6, 123 bytes
var t=(s,n)=>{for(var d=1,i=0,o='',l=s.length;i<l;i++){o+=d?s[i]:s[i-i%n+n-1-i%n]||' ';if(i%n==n-1){d=!d;o+='\n'}}return o}

Call with t(input_string, twist_length), which returns the output string.

Sorry, posted a bit too fast. It's fixed.

Perl, 72 bytes
perl -p0e's/\n(.*)/$"x($1-$-[0]%$1)/e;s/.{$1}/($i++%2?reverse$&:$&)."\n"/ge;chop'

70 bytes, plus 2 bytes for -p0.
Demo:
$ echo -en 'Hello, World!\n5' | perl -p0e's/\n(.*)/$"x($1-$-[0]%$1)/e;s/.{$1}/($i++%2?reverse$&:$&)."\n"/ge;chop'
Hello
roW ,
ld!  $

Note that the input read from STDIN cannot end with a newline (that would cost 2 extra bytes).
Explanation:
perl -p0e'  # Read from STDIN, splitting on null bytes,
            # and print $_ automatically at the end

    s/
        \n(.*)  # Replace everything after first newline,
                # capturing wrap length in $1...
     /
        $"x($1-$-[0]%$1)  # ...with spaces until the total length of $_ is
                          # a multiple of $1 (i.e. right-pad with spaces)
     /e;

    s/
        .{$1}  # Replace series of $1 contiguous chars...
     /
        ($i++%2?reverse$&:$&)."\n"  # ...alternately with themselves or in
                                    # reverse, with a trailing newline
     /ge;

    chop'  # Remove final newline

Japt -R, 9 bytes
òV ËzEÑÃù

Try it

Python 3, 64 bytes
Try Online
def a(s,n,x=1):
 while s:print(s[:n].rjust(n)[::x]);s=s[n:];x=-x

a('Programming Puzzles & Code Golf',4)

Step 1: Print the first n bytes of the string (flag = 1 so normal order)
Step 2: Trim the string by n bytes
Step 3: Flip the flag to -1
Repeat the process until string is empty
Note that flag flips to +1 and -1. When it goes to -1, it prints in reverse order

The question doesn't specify a third parameter. The function header should be a(s,n,x=1)

@JoKing, agreed. Fixed. Also fixed the rjust() problem.

PHP, 135 bytes
Takes two command-line arguments as shown with $argv.
<? foreach($a=str_split($s=$argv[1],$n=$argv[2])as$k=>&$v)$v=$k%2?$v:strrev($v);echo implode("\n",$a).str_repeat(' ',$n-strlen($s)%$n);

CoffeeScript, 131 bytes
This seems too long.
f=(s,n,r=l=s.length,i=0,z='')->(t=s[i...i+=n].split '';t=t.reverse()if r=!r;z+=t.join('')+(i<l&&'\n'||' '.repeat n-l%n))while i<l;z

Julia, 104 bytes
f(s,n)=(L=length(s);L+=L÷n;j=0;for i=1:n:L-n+1 x=rpad(s,L)[i:i+n-1];println(j%2<1?x:reverse(x));j+=1end)

Ungolfed:
function f(s::String, n::Int)
    L = length(s) + length(s) ÷ n
    j = 0
    for i = 1:n:L-n+1
        x = rpad(s, L)[i:i+n-1]
        println(j % 2 == 0 ? x : reverse(x))
        j += 1
    end
end

Python 2, 86 bytes
Here's my answer (borrowing some input processing from @mbomb007). Unfortunately can't define the len(s) as a variable as the length of the string changes after padding with spaces. Now also using rjust() instead of ljust() as @AlexN suggested.
s,n=input()
k=n
while k<=len(s):print s[k-n:k]+'\n'+s[k+n-1:k-1:-1].rjust(n);k+=2*n

Shell/Bash, 135 bytes
s=0;while true;do ((s%($2*2)))&&{ echo "${1:s:$2}"|rev;s=$((s+$2)); }||{ echo "${1:s:$2}";s=$((s+$2)); };((s>=${#1}))&&{ exit 1; };done

Would it be possible to replace the true with either 1 or 1=1?

Yes, you can do while :. I didn't see this answer when I composed my answer, but it has very similar logic, and I borrowed the more concise arithmetic evaluation to reduce my version from 83 bytes to 74.

Python 3, 101 bytes
t,x=eval(input())
print("\n".join([t[c:c+x].ljust(x)[::1-2*(int(c/x)%2)] for c in range(0,len(t),x)]))

Try it here

q, 46
{-1@neg[y]$@[a;(&)(til(#)a:y cut x)mod 2;|:];}

.
q){-1@neg[y]$@[a;(&)(til(#)a:y cut x)mod 2;|:];}["Programming Puzzles & Code Golf";4]
Prog
mmar
ing
zzuP
les
oC &
de G
 flo

This is incorrect when the last line is shorter and not twisted, I wanted to post the bug fix in my answer but I think it'll be better if you can update yours instead: {-1@[l;(&)(til(#)l:y cut x)mod 2;'[neg[y]$;|:]];} (49 bytes). Thanks for the inspiration! :)

Coffeescript, 151 bytes
f=(s,n)->r="";d=n;i=0;_="\n";u=" ";l=s.length;(d--and(r+=s[i]or u;++i)or(r+=_;r+=s[c]or u for c in[i+n-1..i];i+=d=n;r+=_ if i<l))while i<(l/n+1>>0)*n;r

Too much =(

Bash, 83 74
for((i=0;i<${#1};i+=$2));do b=cat;((i/$2%2))&&b=rev;echo ${1:i:$2}|$b;done

This alternates between cat and rev for substrings of the first argument with a length of the second argument.
Special variables used include

${#1} (the length of the string $1)
((i/$2%2)) (an arithmetic expression dividing incrementor $i by $2 and then taking its modulo to determine odd vs even, which dictated whether or not to use rev)
${1:i:$2} (substring of $1 starting at position $i with a length of $2).

Hm, I did this independent of the other bash answer, which I only just saw now.  We have effectively the same logic. ... actually, viktorahlström's answer just let me shave off another 9 characters.

JavaScript ES6, 113 bytes
Just my own crack at my own question. It will add spaces so it is divisible by n, that way it's simply splitting and reversing.
(s,n)=>(s+' '.repeat(n-s.length%n)).match(eval(`/.{1,${n}}/g`)).map((l,i)=>i%2?[...l].reverse().join``:l).join`
`

C (gcc), 145 141 bytes
Not allowing trailing whitespace made it clunkier than otherwise.
Thanks to ceilingcat for the tip that led me on the track to save 4 bytes.
f(s,n,l,i,j)char*s;{for(l=strlen(s),i=0;i<l;i+=2*n)if(printf("%-*.*s\n",n,n,s+i),i+n<l){for(j=i+2*n;j>i+n;)putchar(l/j--?s[j]:32);puts("");}}

Try it online!

Groovy, 68 bytes
f=-n;s.eachMatch(/.{1,$n}/){printf "%${f}s%n",f>0?it[-1..0]:it;f=-f}

revised after I realized the initial version didn't handle padding correctly.
Try it online!

Java 8, 197 146 136 bytes
s->n->{String r="",t,u;for(int l=s.length,i=0,j;i<l/n*n+n;r+=t+"\n",i=j)for(t="",j=i;j<i+n;t=j++/n%2<1?t+u:u+t)u=j<l?s[j]:" ";return r;}

Try it online.
Explanation:
s->n->{                 // Method with String and integer parameters and String return-type
  String r="",          //  Result-String, starting empty
         t,u;           //  Temp-Strings
  for(int l=s.length,   //  Length of the input-String
      i=0,j;i<l/n*n+n   //  Loop `i` in the range [0, `l` + whatever to make blocks of `n`)
      ;                 //    After every iteration:
       r+=t+"\n",       //     Append the result-String with `t` and a new-line
       i=j)             //     And set `i` to `j`
    for(t="",           //   Reset `t`
        j=i;j<i+n;      //   Inner loop `j` in the range [i, i+n)
        ;t=j++/n%2<1?   //     After every iteration: If the k'th block of `n` is even:
            t+u         //      Append `u` to `t`
           :            //     Else (it's odd):
            u+t)        //      Prepend `u` to `t`
      u=j<l?            //    If `j` is still within bounds:
         s[j]           //     Set `u` to the current character
        :               //    Else:
         " ";           //     Set `u` to a space
  return r;}            //  Return the result-String

Japt, 14 bytes
óV y £Yv ?X:Xw

Try it online!

Pip, 34 bytes
Fla.sXb-#(@RVa<>b)<>b{Po?lRVlo!:o}

Similar approach as to my Boustrophedonise answer, but with padding and splitting the string.
Try it online!

05AB1E, 22 bytes
ô0UεRDg²s-úXÈiR}X>U}}»

Try it online!
Bring on the golfing suggestions!

Jelly, 8 bytes
sz⁶ZUÐeY

Try it online!
s           Slice the left argument into pieces (right argument) long.
 z          Zip it with filler
  ⁶         " ",
   Z        zip it back,
    U       reverse the slices
     Ðe     at even 1-indices,
       Y    and join on newlines.

Brachylog, 20 bytes
⟨{ġ|,Ṣ↰}lᵛ⟩{i↔ⁱ⁾}ᶠ~ṇ

Try it online!
Takes input as a list [string, slice length].
⟨{     }                To the string, apply the following predicate:
  ġ                     split it into slices of roughly equal length,
   |                    or
    ,Ṣ                  append a space
      ↰                 and recur.
        lᵛ⟩             ...such that each slice has the prescribed length.
                  ~ṇ    The output, split on newlines, is
           {    }ᶠ      every possible result from
            i           taking a slice with its 0-index
             ↔          and reversing
               ⁾        the slice
              ⁱ⁾        a number of times equal to the index.

I'm a bit ashamed to have only come up with this the moment I had finished explaining my previous solution:
Brachylog, 22 bytes
{|,Ṣ↰}ʰġ₎z₂z{i↔ⁱ⁾c}ᶠ~ṇ

Try it online!
      ʰ                   Apply the following predicate to the input string:
{|                        leave it unchanged, or
  ,Ṣ                      append a space
    ↰}                    and recur.
       ġ                  Split the string into slices
        ₎                 of the given length (except maybe the last one).
         z₂z              Each slice has the same length.
                    ~ṇ    The output, split on newlines, is
            {     }ᶠ      every possible result from
             i            taking a slice with its 0-index
              ↔           and reversing
                ⁾         the slice
               ⁱ⁾         a number of times equal to the index
                 c        (then concatenating it, as the zipping exploded it).

Python 3, 95 bytes
s,z=eval(input());p=0
while p<len(s):a=s[p:p+z].ljust(z);print(a[::-1] if p%(2*z) else a);p+=z

Try it here online:
https://ideone.com/F4aY4d

TIO seems to only count 94 bytes. ...also note that "it may not any trailing whitespace".

@UnrelatedString: what does it mean by "it may not any trailing whitespace"?

Vyxal jr, 5 bytes
ẇ↲⁽Ṙẇ

Try it online!
Explanation:
ẇ      # Get chunks of length n.
 ↲     # Pad each one with spaces to make it n chars long.
    ẇ  # On every second item, call:
  ⁽    # a one element lambda that
   Ṙ   # reverses it's input.
       # Join on newlines with j flag.

Ruby, 80
->s,l{s+=' '*(l-s.size%l)
(s.size/l).times{|i|puts [x=s[i*l,l],x.reverse][i%2]}}

Online demo: http://ideone.com/w6o8PI


text:
Finding the Value of Words!
Introduction
In the land of [Insert cool name here], people don't buy things with money, because everyone has a severe allergy to paper. They pay eachother with words!
But how is that? Well, they give each letter number values:
a=1,b=2,c=3,etc.

(With some other special rules that will be described later)
In this challenge, your task will be to calculate the value of sentences.
Challenge
You will take an input which will be a sentence. You may assume the input has no newlines or trailing spaces. The challenge will be to calculate the value of the sentence, using these rules:
a=1,b=2,c=3,etc.

A capital letter is worth 1.5 times it's corresponding lowercase
letter

H=h*1.5
So, the word
cab

Would be worth c+a+b = 3+1+2 = 6
But the word Cab with a capital c would be worth (c*1.5)+a+b = 4.5+1+2 = 7.5
So if your program input was "Cab" your program would output 7.5

All non alphabetic characters are worth 1.

This is code golf, so shortest answer in bytes wins. Good luck!

Wait, money is paper?? I always thought it was either shiny metal discs or some sort of magic invoked by swiping the sacred card.

Even U.S. banknotes are actually made of cotton and linen..but I guess the people of [Insert cool name here] hadn't thought of that yet.

Are trailing zeros allowed? E.g., printing 7.0 instead of 7?

@kirbyfan64sos Trailing 0s are allowed.

What about spaces?

@juniorRubyist All non-alphabetic characters are worth 1.

Python 3, 71 65 61 bytes
lambda z:sum((ord(s)*1.5**(s<'_')-96)**s.isalpha()for s in z)

By an extraordinary coincidence, (ord(s)-64)*1.5 is equal to ord(s)*1.5-96, so we only have to write -96 once. The rest is pretty straight forward.
Edit: Shaved off some bytes using exponentiation shenanigans.

Python 2, 120 102 bytes
Edit:
e=raw_input()
print sum([ord(l)-96for l in e if not l.isupper()]+[1.5*ord(l)-96for l in e if l.isupper()])

First submission, not so golfy but one has to start somewhere.
def s2(p):
 c=0
 for l in p:
  if l.isupper():
   c+=(ord(l.lower())-96)*1.5
  else:
   c+=ord(l)-96
 return c
print s(raw_input())

Welcome to Programming Puzzles and Code Golf! This post contains some tips for code golfing in Python that may help you better your score. You could start by decreasing the amount of whitespace.

In your second list comprehension why not replace (ord(l.lower())-96)1.5 with 1.5ord(l)-96. You know that l is upper so just work with that and multiply out to remove the parens(64*1.5=96).

You can also remove the space between a closing paren and for in the comprehensions.

If I'm not mistaken, you could make this even shorter by simply making it a lambda with e as a parameter that returns the result.

In the "comprehension" one ?

Pyth, 23 20 bytes
sm|*hxGrdZ|}dG1.5 1z

Live demo and test cases.
Explanation
 m                 z    For each input character
    hxGrdZ              Get the value of it's lowercase form, or 0 for non-alphabetic characters
   *      |}dG1.5       Multiply it by 1 if it's lowercase, 1.5 if uppercase
  |               1     If it's still zero, it's a non-alphabetic character, so use 1 as its value
s                       Sum of all the values

Quite a few creative uses of booleans values as integers here.
23-byte version:
sm+*hxGJrdZ|}dG1.5!}JGz

Live demo and test cases.

This outputs the wrong thing for . (all non-alphabetic characters should be worth 1.)

@Mauris Fixed!!

Julia, 63 bytes
s->sum(c->isalpha(c)?(64<c<91?1.5:1)*(c-(64<c<91?'@':'`')):1,s)

This simply sums an array constructed via a comprehension that loops over the characters in the input string and performs arithmetic on their codepoints.
Ungolfed:
function char_score(c::Char)
    (64 < c < 91 ? 1.5 : 1) * (c - (64 < c < 91 ? '@' : '`')) : 1
end

function sentence_value(s::String)
    sum(char_score, s)
end

Thanks to Glen O for fixing the approach.

Stuck, 85 43 Bytes
Yeah yeah, I know, Python is shorter.. :P I'm using the same logic as Tryth now, for the most part.
s_"str.isalpha"fgl;l-|0Gc"_91<1.5;^*96-":++

Explanation:
s_                                            # Take input & duplicate
  "str.isalpha"fg                             # Filter for only alpha chars, save
                 l;l-|                        # Determine number of symbols in start string
                      0Gc                     # Get saved string, convert to char array
                         "_91<1.5;^*96-":     # Logic to find score for each letter
                                         ++   # Sum the list of nums, add to # of symbols

Python 2, 101 bytes
v=0
for x in raw_input():v+=(ord(x.lower())-96)*(1.5 if ord(x)<96 else 1)if x.isalpha()else 1
print v

CJam, 30 bytes
q:i91,64fm1.5f*32,5f-+1fe>f=:+

How this works (wow, I've never made one of these!):
   91,64fm1.5f*32,5f-+1fe>      Construct an array so that a[i] == score for chr(i)
q:i                             Read STDIN and convert to ASCII codes
                          f=    Index each from the array
                            :+  Sum the result

Javascript (ES6), 85 82 80 67 bytes
I love quick & easy challenges like this. :)
t=>[...t].map(c=>u+=(v=parseInt(c,36)-9)>0?v*(c>'Z'||1.5):1,u=0)&&u

This works by interpreting each char as a base-36 number, multiplying it by 1 or 1.5 if it's greater than 9 (a-z or A-Z), and giving 1 instead if not. As always, suggestions welcome!

The 0 in charCodeAt is bot necessary

@vihan Didn't know that; thanks for the tip!

why not use toString(36)

@l4m2 I'm not sure how .toString(36) applies here. Do you mean something like parseInt(c,36)? Actually, that might be shorter...

You can save some bytes by going recursive and using 2/3 when parseInt returns NaN:  ([c,...t])=>c?(parseInt(c,36)-9||2/3)*(c>'Z'||1.5)+f(t):0

F#, 168 bytes
Not really golfed yet, but a start:
fun(w:string)->w|>Seq.map(fun c->if Char.IsLetter c then (if Char.IsUpper(c) then (float)(Math.Abs(64-(int)c))*1.5 else (float)(Math.Abs(96-(int)c))) else 1.0)|>Seq.sum

Here a more readable version:
let calc (w : string) =
    w
    |> Seq.map (fun c -> if Char.IsLetter c then (if Char.IsUpper(c) then (float)(Math.Abs(64 - (int)c)) * 1.5 else (float)(Math.Abs (96 - (int)c))) else 1.0)
    |> Seq.sum

MATLAB, 68 bytes
This takes advantage of the fact that characters are automatically casted to integers, and that boolean values can be summed as integers.
sum([t(t>96&t<132)-96,(t(t>64&t<91)-64)*1.5,t<65|(t>90&t<97)|t>122])

K, 30
+/1^(,/1 1.5*(.Q`a`A)!\:1+!26)

.
k)+/1^(,/1 1.5*(.Q`a`A)!\:1+!26)"Programming Puzzles & Code Golf"
349f

How it works:
.Q`a`A generates two lists of lowercase and uppercase letters
k).Q`a`A
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"

!:1+til 26maps each letter in each list from 1 to 26
k)(.Q`a`A)!\:1+!26
"abcdefghijklmnopqrstuvwxyz"!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Multiply the first list by 1, the last by 1.5
k)1 1.5*(.Q`a`A)!\:1+!26
"abcdefghijklmnopqrstuvwxyz"!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26f
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"!1.5 3 4.5 6 7.5 9 10.5 12 13.5 15 16.5 18 19.5 21 22.5 24 25.5 27 28.5 30 31.5 33 34.5 36 37.5 39

Raze into a single dictionary using ,/
k)(,/1 1.5*(.Q`a`A)!\:1+!26)
a| 1
b| 2
c| 3
d| 4
..

Map the characters in the input string  to the relevant scores
k)(,/1 1.5*(.Q`a`A)!\:1+!26)"Programming Puzzles & Code Golf"
24 18 15 7 18 1 13 13 9 14 7 0n 24 21 26 26 12 5 19 0n 0n 0n 4.5 15 4 5 0n 10.5 15 12 6

Fill any null values with 1
k)1^(,/1 1.5*(.Q`a`A)!\:1+!26)"Programming Puzzles & Code Golf"
24 18 15 7 18 1 13 13 9 14 7 1 24 21 26 26 12 5 19 1 1 1 4.5 15 4 5 1 10.5 15 12 6

Sum
k)+/1^(,/1 1.5*(.Q`a`A)!\:1+!26)"Programming Puzzles & Code Golf"
349f

JavaScript, 121 bytes
l=process.argv[2].split(""),r=0;for(k in l)c=l[k],o=c.toLowerCase(),r+=(o.charCodeAt(0)-96)*(o===c?1:1.5);console.log(r);

call js file with node (node index.js "Cab")

Perl 5, 77 bytes
@_=split//,$ARGV[0];$i+=(ord)*(/[a-z]/||/[A-Z]/*1.5||96/ord)-96for@_;print$i

Tested on v5.20.2.

Python 3: 86 85 Bytes
t=0
for c in input():k=ord(c)-64;t+=k*1.5if 0<k<27else k-32if 32<k<59else 1
print(t)

C# 81 Bytes
decimal a(string i){return i.Sum(c=>c>64&&c<91?(c-64)*1.5m:c>96&&c<123?c-96:1m);}

Call with (LinqPad):
a("Hello World").Dump();

PHP, 102 bytes
foreach(str_split($argv[1])as$c){$v=ord($c)-64;$s+=A<=$c&&$c<=Z?1.5*$v:(a<=$c&&$c<=z?$v-32:1);}echo$s;

Usage example:
$ php -d error_reporting=0 value.php cab
6
$ php -d error_reporting=0 value.php Cab
7.5
$ php -d error_reporting=0 value.php 'Programming Puzzles & Code Golf'
349

Nothing special in the algorithm. Each character from the first program's argument ($argv[1]) is checked against A and Z then a and z and counted accordingly.

PowerShell, 108 Bytes
Decently competitive, I'm kinda surprised. Not too shabby for not having a compact Ternary operator.
Code:
$a=[char[]]$args[0];$a|%{$b=$_-64;If($b-in(1..26)){$c+=$b*1.5}ElseIf($b-in(33..58)){$c+=$b-32}Else{$c++}};$c

Explained:
$a=[char[]]$args[0]                # Take command-line input, cast as char array
$a|%{                              # For each letter in the array
  $b=$_-64                         # Set $b as the int value of the letter (implicit casting), minus offset
  If($b-in(1..26)){$c+=$b*1.5}     # If it's a capital, multiply by 1.5.
                         # Note that $c implicitly starts at 0 the first time through
  ElseIf($b-in(33..58)){$c+=$b-32} # Not a capital
  Else{$c++}                       # Not a letter
  }
$c                                 # Print out the sum

C, 85 bytes
float f(char*s){return(*s-96)*!!islower(*s)+1.5*(*s-64)*!!isupper(*s)+(*++s?f(s):0);}

The !! before islower and isupper are necessary, because the boolean values returned by these functions  are not guaranteed to be 0 and 1 , true value was 1024 on my system indeed !

Candy, 26 22 bytes

    (~"a"<{A#64-2/3*|A#96-}h)Z

Thanks to @Tryth for the factorization trick!
(~"a"<{A2/3*|A}#96-h)Z

Invokation is with the -I flag, as in candy -I "Cab" -e $prg
The code in it's long form is:
while     # loop while able to consume characters from stack
  peekA   # A gets stack to
  "a"
  less    # is pop() < "a"
  if
    pushA   # capitalized
    digit2
    div
    digit3
    mult
  else
    pushA   # lower case
  endif
  number
  digit9
  digit6
  sub
  popAddZ   # add pop() to counter register Z
endwhile
pushZ       # push Z onto stack as answer

Prolog (SWI), 101 bytes
Code:
X*Y:-X>64,X<91,Y is X*1.5-96;X>96,X<123,Y is X-96.
_*1.
p(L):-maplist(*,L,A),sumlist(A,B),write(B).

Explained:
X*Y:-X>64,X<91,       % When X is upper case
     Y is X*1.5-96    %      Y is 1.5 times charvalue starting at 1
     ;X>96,X<123,     % OR when X is lower case
     Y is X-96.       %      Y is charvalue starting at 1
_*1.                  % ELSE Y is 1
p(L):-maplist(*,L,A), % Get list of charvalues for all chars in string
      sumlist(A,B),   % Take sum of list
      write(B).       % Print

Example:
p(`Cab`).
7.5

PHP, 75 bytes
while(~$c=$argn[$i++])$r+=ctype_alpha($c)?ord($c)%32*(1+($c<a)/2):1;echo$r;

Run as pipe with -nr or try it online.

Ruby, 48 bytes
->s{s.bytes.sum{_1>64&&_1<91?(_1-64)*1.5:_1-96}}

Attempt This Online!

source: Stack Exchange

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

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

sort: votes


text:
Toggle, Print, Repeat
This challenge is loosely inspired by the unimplemented esolang Pada.
Consider an array of 8 bits, all initialised to zero. We'll introduce a very minimalistic instruction set to print arbitrary strings. There are two instructions, both of which take a parameter N which is the index of a bit:

t N for toggle: This changes the value of bit N.
p N for print: This interprets all 8 bits as a byte, starting from bit N and wrapping around the end. The character corresponding to this byte is printed to STDOUT.

Let's look an example. We want to print :=. Naively we achieve this as follows (0-based bit indices):
t 2    [0 0 1 0 0 0 0 0]
t 3    [0 0 1 1 0 0 0 0]
t 4    [0 0 1 1 1 0 0 0]
t 6    [0 0 1 1 1 0 1 0]
p 0    [0 0 1 1 1 0 1 0] == 58 == ':'
t 5    [0 0 1 1 1 1 1 0]
t 6    [0 0 1 1 1 1 0 0]
t 7    [0 0 1 1 1 1 0 1]
p 0    [0 0 1 1 1 1 0 1] == 61 == '='

But instead, we can make use of the cyclic feature of p and save two instructions:
t 2    [0 0 1 0 0 0 0 0]
t 3    [0 0 1 1 0 0 0 0]
t 4    [0 0 1 1 1 0 0 0]
t 6    [0 0 1 1 1 0 1 0]
p 0    [0 0 1 1 1 0 1 0] == 58 == ':'
t 1    [0 1 1 1 1 0 1 0]
p 7    [0 1 1 1 1 0 1 0] == [0 0 1 1 1 1 0 1] == 61 == '='
                      ^

So p 7 simply starts reading the byte value from the last bit instead of the first.
The Challenge
Given a non-empty string of printable ASCII characters (0x20 to 0x7E, inclusive), produce an optimal list of instructions (one line per instruction) to print that string with the above system. If there are multiple optimal solutions (which will almost always be the case), generate only one of them.
You may choose between 0-based and 1-based indexing for the bits, but please state your choice.
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest alternative), function return value or function (out) parameter. If you don't print the result to STDOUT, it should still be a single newline-separated string.
This is code golf, so the shortest answer (in bytes) wins.
Test Cases
Each test case is a single line containing the input string, followed by the optimal number of instructions, followed by one possible solution.
You should not output the instruction count in your solution - this is only included here so you can check the correctness of your code if it prints a different instruction list.
?
7 instructions
t 2
t 3
t 4
t 5
t 6
t 7
p 0

:=
7 instructions
t 2
t 3
t 4
t 6
p 0
t 1
p 7

0123456789
26 instructions
t 2
t 3
p 0
t 7
p 0
t 6
t 7
p 0
t 7
p 0
t 5
t 6
t 7
p 0
t 7
p 0
t 6
t 7
p 0
t 7
p 0
t 2
t 3
p 3
t 2
p 3

9876543210
28 instructions
t 2
t 3
t 4
t 7
p 0
t 7
p 0
t 0
t 7
p 5
t 4
p 5
t 0
t 5
p 0
t 7
p 0
t 5
t 6
t 7
p 0
t 7
p 0
t 6
t 7
p 0
t 7
p 0

Hello, World!
39 instructions
t 1
t 4
p 0
t 3
t 7
p 2
t 1
t 6
p 2
p 2
t 0
t 1
p 2
t 0
t 1
t 3
p 2
t 6
t 7
p 2
t 0
t 2
t 6
t 7
p 1
t 0
t 1
t 5
p 0
t 2
t 7
p 3
t 2
t 6
p 0
t 4
p 0
t 1
p 3

The quick brown fox jumps over the lazy dog.
150 instructions
t 1
t 3
t 5
p 0
t 1
t 2
p 1
t 1
t 3
t 7
p 0
t 1
t 5
t 7
p 0
t 1
t 3
t 7
p 0
t 5
p 0
t 3
t 4
t 5
p 0
t 4
t 6
p 0
t 4
p 0
t 1
t 4
t 6
t 7
p 0
t 1
t 6
p 0
t 3
p 0
t 0
t 5
p 4
t 0
t 7
p 0
t 1
p 1
t 3
t 5
t 6
t 7
p 0
t 1
t 5
t 6
p 0
t 4
t 7
p 0
t 1
t 2
p 3
t 5
t 6
t 7
p 2
t 1
t 2
t 6
p 0
t 0
p 7
t 0
t 7
p 5
t 3
t 4
t 6
t 7
p 0
t 6
t 7
p 0
t 1
t 3
t 6
t 7
p 0
t 1
t 4
t 5
t 6
t 7
p 0
t 4
p 4
t 6
p 0
t 1
t 6
p 4
t 5
t 6
t 7
p 0
t 1
t 3
t 5
p 0
t 1
p 1
t 1
t 3
t 7
p 0
t 1
t 5
t 7
p 0
t 1
t 4
t 5
p 0
t 1
p 3
t 3
t 7
p 1
t 1
t 5
p 0
t 1
t 3
t 4
t 7
p 0
t 1
t 5
p 0
t 4
t 6
t 7
p 0
t 4
p 0
t 1
t 4
t 7
p 0

The test cases were generated with this CJam reference implementation.

CJam, 67 bytes
U]8*l{i2b8Ue[8,{1$m>2$.^:+}$0=_@m>@1$.^ee{~{"t "op}{;}?}/"p "o\p}/;

Try it online
Explanation:
U]8*    Build start bit array [0 0 0 0 0 0 0 0].
l       Get input.
{       Start loop over input characters.
  i       Convert character to integer.
  2b      Convert to binary array.
  8Ue[    Pad to 8 entries with leading 0.
  8,      Generate list of possible rotation amounts.
  {       Start of sort function block.
    1$      Get bit array of character.
    m>      Rotate by rotation amount.
    2$      Get previous bit array.
    .^      Element-wise xor to get different bits.
    :+      Add elements in result to get count of different bits.
  }$      Sort possible rotations by count of different bits.
  0=      Get first rotation amount in sorted list, which is the one with the
          one that results in the smallest count of different bits.
  _       Copy count. Will use original for "p" output later.
  @       Get the character bit array to top of stack.
  m>      Rotate it, to get optimal rotated bit array.
  @       Get previous bit array to top of stack.
  1$      Copy rotated bit array, will need the original as starting point
          for next character.
  .^      Element-wise xor to get different bits.
  ee      Enumerate array to get pairs of index and bit value.
  {       Loop over bits.
    ~       Unpack index bit pair.
    {       Start of if block for bit value.
      "t "o   Output "t ".
      p  Output index and newline.
    }       End of if block.
    {       Start of else block.
      ;       Pop the index value.
    }?      End of ternary if.
  }/      End loop over bits.
  "p "o   Output "p ".
  \       Swap rotation amount to top.
  p       Print rotation amount and newline.
}/      End loop over input characters.
;       Ppp current bit array off stack to prevent extra output.

Ruby, 171
->w{s=[0]*8
w.chars.flat_map{|c|z=0..7
*m,i=z.map{|j|z.select{|k|s[k]!=z.map{|i|c.ord[i]}.rotate(j)[k]}<<j}.min_by &:size
m.map{|m|s[m]=1-s[m];"t #{7-m}"}+["p #{i}"]}*?\n}

A Ruby function that's only double the size of the reference implementation. :)
Try it online: http://ideone.com/ysYyFP
The program is pretty straighforward: it starts off with the 8 bits set to 0 and iterates through the characters. At each step, it takes the shortest route from the current state to a state that would allow printing the character. It returns a string in the specified format.
The initial (less golfed) version of the program is available here.

CJam, 81 76 bytes
Still a lot to golf.
0]8*q{i2b8Te[8,\fm>:X\_@\f.=::+_$W=#:YX=_@.{=M['tSUN]?U):U;}o0:U;['pSYN]o}/;

Try it online.

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


text:
Create rainbow text
Your challenge is to take input as a line of text and output it like this.

Input / output
The input will be a string that contains only printable ASCII characters. The first or last characters will never be spaces, and there will never be two spaces in a row. It will always be at least two characters long.
Your output should be the same string, converted to rainbow colors as will be described below. The output may be in image form (saved to a file or somehow otherwise made available), or it may simply display the result on the screen (as the reference implementation below does).
Conversion
To determine what color each letter in the string should become, use the following algorithm. Note that each letter is its own individual color. This is not a gradient!

If this character is a space:

... it doesn't matter, because spaces can't really... have a color anyway. Simply output a space.

Otherwise:

Let i = the index of this character in the string (0-based, so for the very first letter, this is 0), not counting spaces. For example, in the string foo bar, this value would be 4 for the a. In other words, this is how many non-spaces have been encountered so far.
Let n = the number of non-spaces in the string.
The color of this letter can now be expressed, in the HSL cylindrical-coordinate system, as [hue=(i/n)*360°, saturation=100%, lightness=50%].

Note that these directions imply that the output for foo and f oo should be exactly the same, except for an added space after the f. That is, all the letters should retain the same colors.
Further rules for the conversion process are described below, in the Rules section.
Reference implementation
This is written in JavaScript, and you can try it by pressing the "Run code snippet" button.

window.addEventListener('load', function() {
    addRainbow('Your challenge is to take input as a line of text and ' +
        'output it like this.');
});

// append this text rainbow-ified to the argument (document.body by default)
function addRainbow(text, el) {
    (el || document.body).appendChild(makeRainbow(text));
}

// returns a
 that contains the text in a rainbow font
function makeRainbow(text) {
    var div = document.createElement('div');
    var letterCount = text.replace(/ /g, '').length, spaceCount = 0;
    text.split('').forEach(function(letter, idx) {
        if (letter == ' ') ++spaceCount;
        div.appendChild(makeLetter(letter, (idx - spaceCount) / letterCount));
    });
    return div;
}

// returns a  that contains the letter in the specified color
function makeLetter(letter, hue) {
    hue = Math.floor(hue * 360);
    var span = document.createElement('span');
    span.appendChild(document.createTextNode(letter));
    span.style.color = 'hsl(' + hue + ', 100%, 50%)';
    return span;
}

Rules

When computing the Hue value of a letter, you will almost certainly get a decimal (non-integer) number. You may round this to the nearest integer, floor it, take the ceiling, or simply not round at all.
The font size must be readable. Here, this is defined as a 10pt size font or greater.
You may use a fixed-width canvas or "drawing area" to output the text, but it must be able to fit the example given in the very first sentence of this post.
Scoring is code-golf, so the shortest code in bytes will win.

Can the output be a Data URI? That's the output from the HTML canvas

@vihan Yes, that qualifies as per the "The output may be in image form (saved to a file or somehow otherwise made available)" rule.

How do you determine whether a coloration meets the spec? Can you specify precisely what conversion formula one should use if only RGB colors are supported in a language? Also, how many bits of precision per channel are necessary? Presumably 8 would be OK, but how about 4, or 1?

@feersum To convert to RGB, you may use a builtin or one of the methods described here. Could you clarify what you mean by your second question? Are you asking about this specifically in the context of HSL to RGB conversion, or in general?

Dang, I'm not even going to try with PowerShell ... You only get 16 colors to play with (and they're not even ordered ... rainbow or RGB or otherwise ... just an arbitrary hex value).
Reference, with Pictures
Really cool challenge, though!

Perl 5.28.1 (webperl) + -p, 88 bytes
@c=unpack C35,"..........vR../012.3-'!..9]........";s|\S|.[38;5;$c[@c*$i++/y/!-~//]m$&|g
Try it online!
Explanation
This script uses an approximation of the colours available to terminal (256 maximum) currently only including a few colour points selected from this list, so it is likely not to spec, but this was fun anyway! I filtered the list to only show colours with S and L values of 100% and 50% respectively, then sorted by hue, packed the numbers into a string and select the colours from that list.
This implementation includes non-printable characters! Stole @edc65's idea of only replacing \S instead of ., simple, but clever!

Python 2: 240 using PIL and colorsys lib
import PIL,colorsys as c
s=input()
u,a=len(s),255
g=Image.new('RGB',(u*6,13),(a,)*3)
[ImageDraw.Draw(g).text((j*6,0),s[j],fill=tuple(int(h*a)for h in c.hls_to_rgb(1.*(j-s[:j].count(' '))/(u-s.count(' ')),.5,1)))for j in range(u)]
g.show()

Example output:

Thanks to @agtoever and @Trang Oul for some golfing tips, and for @Mauris for pointing out the spaces requirement.
To add a true type fonts, font size control, including horizontal offset and color change based on length.
import PIL as P,colorsys as c
s=input()
u=len(s)
a=255
fs=25
f=P.ImageFont.truetype("a.ttf",fs)
sza=f.getsize(s)
oa=f.getoffset(s)
g=P.Image.new('RGB',(sza[0]+fs,2*sza[1]+oa[1]),(a,)*3)
r=fs/4
P.ImageDraw.Draw(g).text((r,0),s,fill=(0,0,0),font=f)
for j in range(u):
 o=f.getoffset(s[j])
 sz=f.getsize(s[j])
 r+=o[0]
 P.ImageDraw.Draw(g).text((r,0+fs),s[j],fill=tuple([int(h*a)for h in c.hls_to_rgb(1.*r/sza[0],.5,1)]),font=f)
 r+=sz[0]
g.save('a.png')
g.show()

The font I used is available from here:
The result is (the top is just printing the string, the one below is printing per letter):

Drop as P and write out PIL twice and win one character. Change img to i and win 4 more characters.

Also (not tested), I think you can drop the tuple keyword. A comma separated arguments between braces is automatically regarded to be a tuple.

Save 255 to a variable, replace all ocurrences and use (a,)*3 as white colour. Replace float(j) by (j+.0).

Also: replace float(j) to 1.*j

@agtoever unfortunenately the tuple function is needed.

Assign multiple variables simultaneously (e.g. u=len(s) a=255 => u,a=len(s),255). Remove [] brackets from tuple, they're not needed. Replace loop by list comprehension (method will be evaluated as a side effect).

This doesn't look like it handles space characters correctly?

@Mauris, I assume you are refering to the spacing? I noticed that as well, I have fixed it now (see example above).

@willem: Take a look at the problem specification (under Conversion); it specifically explains how your program should handle spaces.

JavaScript (ES6), 114 117 125
Edit2 3 bytes saved thx @Dom Hastings
Edit Invalid HTML, but working anyway.
Usual note: test running the snippet on an EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox)

F=s=>document.write(s.replace(/\S/g,c=>`<b style=color:hsl(${i++/s.replace(/ /g,'').length*360},100%,50%>`+c,i=0))
<input value='Your challenge is to take input as a line of text and output it like this.' id=I size=100>
<button onclick='F(I.value)'>-></button>

No browser is completely ES6 compliant, yet. IE isn't even fully ES5 compliant yet!

@SuperJedi224 I agree. I'm just saying: don't try it with Chrome or MSIE, while using Firefox it works

I feel like I shouldn't even say anything because I've only just got mine under yours, but I think you can omit the ) after your hsl( declaration as that appears to still work for me in Firefox!

Also, you can change ${c}' to '+c to save 2 more... Better get back on with mine!

This does not work on Safari 9.0. c:

@VoteToClose thx, updating my answer

Python 3, 131 bytes
Simular to Dom Hastings' answer but implemented in python.
The string '|\x82\x88\x8ejF"#$%\x1f\x19\x137[\x7f~}' was built form the list [124,130,136,142,106,70,34,35,36,37,31,25,19,55,91,127,126,125] is the terminal colour codes to display in order. They have been filtered so they only include colours with saturation 100% and value 50%. The list was then sorted so the correct hues were displayed first.
Takes input from stdin and returns it to stdout.
Your terminal you are using MUST support ANSI escape codes to run this properly.
x=input();u=u'|\82\88\8ejF"#$%\1f\19\137[\7f~}';j=0
for i in x:print('\033[38;5;%dm%s'%(ord(u[j*18//len(x.replace(" ", ""))]),i),end="");j+=i!=" "

Or shortened version with literal byte characters (Didn't paste properly):
x=input();u='|<82><88><8E>jF"#$%^_^Y^S7[^?~}';j=0
for i in x:print('ESC[38;5;%dm%s'%(ord(u[(j*18)//len(x.replace(" ", ""))]),i),end="");j+=i!=" "

Literal hexdump:
783d696e70757428293b753d277c82888e6a46222324251f1913375b7f7e7d273b6a3d300a666f72206920696e20783a7072696e7428271b5b33383b353b25646d25732725286f726428755b286a2a3138292f2f6c656e28782e7265706c616365282220222c20222229295d292c69292c656e643d2222293b6a2b3d69213d2220220a

Thanks @swstephe for saving 9 bytes (and also making me notice my byte counting was ever so slightly very wrong)!

Why not replace "\x82" with the actual character?  I wrote that string to a file and read it back into my script in binary.  You could replace \033 with a raw escape character, or even \1f (hex).  You declare "u", then only use it once.  You can save a few characters by moving it down into the expression.  You can avoid the int() call by using "//" for integer divide.

oops, \033 is the same as \x1f.

PHP, 165 bytes
Run with input as the parameter "s"
The HTML is invalid but it should render in all major browsers (tested in Chrome and Firefox)
<?php $n=preg_match_all("/[^ ]/",$q=$_GET['s']);for($i=$j=0;$j<strlen($q);$j++){if(" "!=$s=$q[$j])$i+=360;echo"".$s;}

PHP 4.1, 112 103 102 bytes
I've used @DankMemes' answer as a starting point. From there on, I've implemented a ton of changes, to the point that the code is different.
The implementation is similar, the code is totally different.
foreach(str_split($s)as$c)echo"$c";

To use it, simply set a value on a SESSION/GET/POST/COOKIE with the name s.
Result of running this function, on the test sentence:

Your challenge is to take input as a line of text and output it like this.


text:
Num of pyramids possible with given number of bricks
I encountered this question in an interview and could not figure it out. I believe it has a dynamic programming solution but it eludes me.
Given a number of bricks, output the total number of 2d pyramids possible, where a pyramid is defined as any structure where a row of bricks has strictly less bricks than the row below it. You do not have to use all the bricks.
It makes sense to just add P(1) + ... + P(n), but how to find all possible pyramids with 1 < i <= n bricks?
Code length is not as important as the solution itself, but go ahead and have fun with it?

You need to know the answer to a question to pose it as a challenge. Otherwise, you don't know if it will be interesting to optimize. Really, it sounds like you want programming help, and there's sites for that. Also, it's totally unclear what the bricks are and how they are stacked.

Ah, sorry, I misunderstood the purpose of this site

I would say with quite a bit of work there's a valid challenge in there somewhere. Specifically: 1. proper specification  of what brick stackings are valid, with examples (is a flat row a valid "pyramid") 2. definition of winning criterion (for example code golf = shortest code.)

The number of pyramids with i bricks is A000009(i). From a quick look at the formula section in OEIS, I would vote to close a question which asks us to calculate it as a duplicate of this related question.


text:
Sign that word 2!
Sign that word 2!
Not that long ago, I posted a challenge called Sign that word!. In the challenge, you must find the signature of word, which is the letters put in order (e.g. The signature of this is hist). Now then, that challenge did quite well, but there was one key issue: it was WAY too easy (see the GolfScript answer). So, I've posted a similar challenge, but with more rules, most of which have been suggested by PPCG users in the comments on the previous puzzle. So, here we go!
Rules

Your program must take an input, then output the signature to STDOUT or the equivalent in whatever language your using.
You are not allowed to use built-in sorting functions, so stuff like $ in GolfScript is not allowed.
Multicase must be supported - your program must group letters of both uppercase and lowercase together. So the signature of Hello is eHllo, not Hello as you are given by the GolfScript answer on the first version.
There must be a free interpreter/compiler for your program, which you should link to.

Scoring
Your score is your byte count. Lowest byte count wins.
Leaderboard
Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
# Language Name, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

var QUESTION_ID=55090;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),e.has_more?getAnswers():process()}})}function shouldHaveHeading(e){var a=!1,r=e.body_markdown.split("\n");try{a|=/^#/.test(e.body_markdown),a|=["-","="].indexOf(r[1][0])>-1,a&=LANGUAGE_REG.test(e.body_markdown)}catch(n){}return a}function shouldHaveScore(e){var a=!1;try{a|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(r){}return a}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading),answers.sort(function(e,a){var r=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0],n=+(a.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0];return r-n});var e={},a=1,r=null,n=1;answers.forEach(function(s){var t=s.body_markdown.split("\n")[0],o=jQuery("#answer-template").html(),l=(t.match(NUMBER_REG)[0],(t.match(SIZE_REG)||[0])[0]),c=t.match(LANGUAGE_REG)[1],i=getAuthorName(s);l!=r&&(n=a),r=l,++a,o=o.replace("{{PLACE}}",n+".").replace("{{NAME}}",i).replace("{{LANGUAGE}}",c).replace("{{SIZE}}",l).replace("{{LINK}}",s.share_link),o=jQuery(o),jQuery("#answers").append(o),e[c]=e[c]||{lang:c,user:i,size:l,link:s.share_link}});var s=[];for(var t in e)e.hasOwnProperty(t)&&s.push(e[t]);s.sort(function(e,a){return e.lang>a.lang?1:e.lang<a.lang?-1:0});for(var o=0;o<s.length;++o){var l=jQuery("#language-template").html(),t=s[o];l=l.replace("{{LANGUAGE}}",t.lang).replace("{{NAME}}",t.user).replace("{{SIZE}}",t.size).replace("{{LINK}}",t.link),l=jQuery(l),jQuery("#languages").append(l)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/,NUMBER_REG=/\d+/,LANGUAGE_REG=/^#*\s*([^,]+)/;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

Must lowercase and uppercase be ordered? For example, for ThHihs, can we output hHhist or do we have to output hhHist or Hhhist?

I cannot comprehend rule 3.

@Fatalize As long as they are grouped together, it doesn't matter. It can be any of those.

@feersum Try running the GolfScript answer on the first version of this challenge with the string "Hello" (without the quotes). Then you should see what I mean.

@Kslkgh I do not wish to install a GolfScript interpreter in order to understand the question. The requirements should be clearly specified in the question itself.

@feersum You don't need to. There is a link in the answer to an online interpreter. But I will make it clearer.

So what you really mean is that the sorting should be case-insensitive? Why not simply say so?

Let us continue this discussion in chat.

Correctly handling lower/upper case in Unicode is scary, so is this question voluntarily limited to ASCII letters: [a-zA-Z]?

You forgot to close the parenthesis after "see this GolfScript answer". https://xkcd.com/859/

"Your score is your byte count." So I rank better when I have more bytes? Maybe you should update that one :P

@JonasDralle: remember, this is golf, where scoring is always backwards!

Pyth, 10 bytes
sm@+drd1zG

Try it online: Demonstration
Explanation:
             implicit: z = input string
 m       G   map each letter (variable d) of the alphabet to:
   +drd1        d + upper(d)
  @     z       filter z for these two letters
s            sum, join to a string

GOTO++, 531 bytes
niveaugourou 0
s=ENTRETONTEXTE()
§2 a=LeCaracNumero()&s *(1)
n=*(1)
costaud i=*(2)/&i infeg NombreDeLettres(&s)/i=+*(1)
b=LeCaracNumero()&s &i
c=&b
d=&a
GOTONULPOURLESNULS %4 }&b sup *(96){
c=-*(32)
§4 GOTONULPOURLESNULS %5 }&a sup *(96){
d=-*(32)
§5 GOTONULPOURLESNULS %1 }&c inf &d{
a=&b
n=&i
§1 faiblard
GOTOPRINTDUTEXTE()&a
s=Marijuana()}BOITEAPINGOUINS()}PrendsUnMorceau()&s *(0) &n{ }PrendsUnMorceau()&s }&n+*(1){ *(0){{ «»
GOTONONNULPOURLESNULS %3 }NombreDeLettres(&s) eg *(1){
GOTOPASMALIN %2
§3 GOTOPRINTDUTEXTE()&s

GOTO++ Project page
Here's a slighlty more readable and commented version of the code(Note that GOTO starts a comment in GOTO++):
niveaugourou 0                                          GOTO Allow every keyword to be used
s=ENTRETONTEXTE()                                       GOTO Read from STDIN
§2 a=LeCaracNumero()&s *(1)                             GOTO Get first char in s
n=*(1)
costaud i=*(2)/&i infeg NombreDeLettres(&s)/i=+*(1)     GOTO Loop on every char of s
b=LeCaracNumero()&s &i                                  GOTO b = i-th char
c=&b
d=&a
GOTONULPOURLESNULS %4 }&b sup *(96){                    GOTO If b is uppercase, goto §4
c=-*(32)                                                GOTO Get the uppercase ASCII value of b
§4 GOTONULPOURLESNULS %5 }&a sup *(96){                 GOTO same as above but with a
d=-*(32)
§5 GOTONULPOURLESNULS %1 }&c inf &d{                    GOTO If b is after a in alphabetical order, goto §1 (next loop iteration)
a=&b                                                    GOTO Else replace a by b
n=&i
§1 faiblard                                             GOTO End loop
GOTOPRINTDUTEXTE()&a                                    GOTO Print the value of a
t=PrendsUnMorceau()&s *(0) &n                           GOTO Get the part of s before a
u=PrendsUnMorceau()&s }&n+*(1){ *(0)                    GOTO Get the part of s after a
e=BOITEAPINGOUINS()&t &u                                GOTO Create an array of penguins containing the two substrings
s=Marijuana()&e «»                                      GOTO Concatenate the penguins in the array
GOTONONNULPOURLESNULS %3 }NombreDeLettres(&s) eg *(1){  GOTO If s is one char long, goto §3
GOTOPASMALIN %2                                         GOTO Else goto §2
§3 GOTOPRINTDUTEXTE()&s                                 GOTO Print the last char

Marks of a great programming language: all commands are in French and the official website says "Send your logo et look dumb."

@AlexA. Mark of a great programming language: function(arg) and function() arg are both valid. Also, priority brackets are } { and not the boring ( )

Python 3, 72 70 bytes
s=input()
print("".join(d*(ord(d)&31==c)for c in range(27)for d in s))

Assumes the input consists of only [a-zA-Z].
(-2 bytes thanks to @xnor)

I think you can do "".join(c*b ...) for "".join(c ... if b)  the same way sum(n ... if b) can be sum(n*b ...).

Collapsing the two loops into a single loop with a sentinel, and compressing the equality check: c=1 for d in(input()+'~')*26:print(d[ord(d)&32^c:],end='');c+=d>'z' (67)

@xnor I've added the first tip (thanks!) but I think you should post the second as a separate answer :)

Haskell, 51
f s=[x|(a,b)<-zip['a'..'z']['A'..],x<-s,x==a||x==b]

The zip creates a list of pairs of characters [('a','A'), ...('z','Z')]. Because of truncation, the second endpoint doesn't need to be specified. For each pair in the list, we take the letters in the input string s that are either of the two characters in the pair.

Pyth, 15 14 bytes
s*V/LzJ.irG1GJ

Thanks for isaacg for removing 1 byte.
I don't know much about Pyth yet, so this may not be golfed well.
Try it here.

One easy golf: s is the same as jk on a list of strings.

Javascript, 112 194 bytes
r=[];t=[];a=s.split('').map(function(x){t[i=parseInt(x,36)]?t[i].push(x):t[i]=[x];return i;});while(l=a.length)r[l-1]=t[a.splice(a.indexOf(Math.max.apply({},a)),1)].pop();console.log(r.join(''))

This is far away from "golfed" but I'm a bit busy right now, just editted to remove sort.

@frikinside While it might not help this solution since sorting was disallowed, Javascript ES6 arrow functions could help shorten this. (Not all browsers support ES6 yet, try Firefox). Maybe it'll help your future solutions though! :) An example of what it might look like: console.log(input.split('').sort((a,b)=>a.toLowerCase().localeCompare(b.toLowerCase())).join(''))

@UndefinedFunction Actually I choose to use plain javascript on purpose, for the "challenge" but thx a lot for the nice suggestion!

@edc65 actually I was aware of that in a previous comment (like u said) and I did not forget it, I wasn't have time until now.

JavaScript (ES6), 71 74
Limited to A-Za-z (see comment by @Matthieu M)
Edit Too used to compose a single expression with commas, to avoid 'return'. Here an output is required, so I can use a simple for and forget about commas.
Using array comprehension the byte count is 73, but that is not valid EcmaScript 6 anymore
Usual note: test running the snippet on any EcmaScript 6 compliant browser (notably not Chrome not MSIE. I tested on Firefox, Safari 9 could go)

f=w=>{v=[];for(c of w)v[n=parseInt(c,36)]=(v[n]||'')+c;alert(v.join``)}
<input id=I value='Hellzapoppin'><button onclick=f(I.value)>-></button>

Python 3, 64
A small improvement on Sp3000's answer, which uses the idea of iterating iterating the character indices, and for each one, iterating through the input to take characters that match up to case.
c=1
for d in(input__+'~')*26:print(end=d[ord(d)&31^c:]);c+=d>'z'

This uses a single loop, looping through the input 26 times. The separator ~ is used to know when to go to the next character index c. To whether character d matches value c up to case, the last five bits of the bit-value of d are xor-ed with c, with a 0 indicating a match.
Then, the character d is printed exactly when the result is 0, with an empty string otherwise.

PHP, 275 270 bytes
<?php
for($i=65;$i<123;$i++){$v[$i]=chr($i);}foreach(str_split($argv[1])as$c){$a=array_search($c,$v);if($a<97){$p[]=($a+32);$z[]=$a;}else{$p[]=$a;}}foreach($p as$chr){$m=min($p);if($z[0]+32==$m){echo chr($m-32);unset($z[0]);}else{echo chr($m);}unset($p[array_search($m,$p)]);}

Explanation:

The code generates an array with every letter in the alphabet, which has its ASCII Value as Array Key. Afterwards the code generates a new array which contains the ASCII Values of the Input. Then the lowest Value gets printed out and gets removed.

Usage:

Call the script with an argument: php -d error_reporting=0 script.php Hello

Ungolfed Version:

<?php
$input = $argv[1];
$valueArray = [];
for($i=65;$i<123;$i++) {
    $valueArray[$i] = chr($i);
}
$new = str_split($input);
foreach($new as $char) {
    if(array_search($char, $valueArray)<97) {
        $newArray[] = (array_search($char, $valueArray)+32);
        $checkArray[] = array_search($char, $valueArray);
    } else {
        $newArray[] = array_search($char, $valueArray);
    }
}
foreach($newArray as $chr) {
    if($checkArray[0]+32 == min($newArray)) {
        $string .= chr(min($newArray)-32);
        unset($checkArray[0]);
    } else {
        $string .= chr(min($newArray));
    }
    $key = array_search(min($newArray), $newArray);
    unset($newArray[$key]);
}

echo $string;

Any advices are greatly appreciated.

Uppercase letters are not working ... need to fix this.

Fixed that the code also works when the Input has Uppercase letters.

Python 2.7, 114 106 bytes
l=[0]*123
for e in raw_input():l[ord(e)]+=1
print''.join(chr(j)*l[j]for i in range(26)for j in(i+65,i+97))

Logs the presence of a char in a 123 length array(for including both A-Z and a-z ranges) and then iterates through it to get the non-zero entries.
Inefficient, but more efficient than brute forcing it(but longer :().
Testing it-
<< HelloWorldhi
>> deHhillloorW

When I run it with HelloWorldhi, I get ['d', 'e', 'H', 'h', 'i', 'lll', 'oo', 'r', 'W']

@muddyfish oops my bad. I pasted the wrong code while trying out a couple of things. Thanks for that :)

You don't need the if l[j] either.

@muddyfish Nice, they become empty strings(and are removed when joined). -8 bytes. Thanks :)

You could replace raw_input with just input if your input is 'HelloWorldhi' instead of HelloWorldhi.

@SirParselot Yeah, but that seemed like modifying the input as given in the question, so didn't do that

It doesn't say anything about it in the instructions, but it's your code so it's up to you

Haskell, 83 53 bytes
import Data.Char
f y=[c|x<-[' '..],c<-y,toLower c==x]

Usage: f "HelloWorldhi" -> "deHhillloorW".
How it works: let y be the input string
[ |x<-[' '..]                  ]  -- for every x from Space to the last Unicode character
             ,c<-y                -- loop through all character c from the input string
 c                ,toLower c==x   -- and keep those where the lowercase version equals x

Edit: 30 bytes saved, imagine that! Thanks @Mauris.

Why not just import Data.Char;f y=[c|x<-[' '..],c<-y,toLower c==x] (53 bytes)? (This will take some time to terminate, because length [' '..] == 1114080 -- but it's finite.)

@Mauris: Wow! Btw: 8.5sec on a 4 year old laptop is not too long.

Python 3, 61 bytes
A new answer for a different technique!
z=['']*42
for c in input():z[ord(c)&31]+=c
print(*z,sep='')

Noting that ord('a')&31==ord('A')&31 and that ord('z')&31==ord('Z')&31, we can simply create an array of empty strings and for each character add it to the array index of its ASCII value &31. When you print it, it will be sorted.
Limited to input a-zA-Z.

APL (Dyalog Extended), 8 bytes
s⊇⍨⍋⌈s←⍞

Try it online!
(If a function were OK, it would have been 5 bytes ⍋⍤⌈⊇⊢.)
⍋ can be controversial here, because the challenge says "built-in sorting functions not allowed" and ⍋, called "Grade", is definitely related to sorting but it doesn't sort the input by itself. Instead, it gives a list of indices which, when used to index into the original input, results in the sorted array:
      x←10 50 20 40 75
      ⍋x
1 3 4 2 5
      x[⍋x]
10 20 40 50 75

This can be also used to implement "sort-by", if we index into a different array other than x:
      'abcde'[⍋x]
acdbe

How it works
s⊇⍨⍋⌈s←⍞  ⍝ Full program
     s←⍞  ⍝ Take a line of string input and assign to s
    ⌈     ⍝ Uppercase the letters
   ⍋      ⍝ Grade up; find the sorting order
s⊇⍨       ⍝ Index into the original string s,
          ⍝ essentially sorting the string in the case-insensitive order

If ⍋ is not acceptable:
APL (Dyalog Extended), 12 bytes
∊⍞∘∩¨⎕A,¨⌊⎕A

Try it online!
Set intersection in APL is essentially "erase the items in the left argument that do not appear in the right argument", so the duplicates in the left argument is preserved.
How it works
∊⍞∘∩¨⎕A,¨⌊⎕A  ⍝ Full program.
     ⎕A,¨⌊⎕A  ⍝ Pair each char in ⎕A (uppercase letters) with its lowercase
 ⍞∘∩¨         ⍝ Take intersection of entire input and each pair of chars
∊             ⍝ Flatten

Python 3, 97 92 bytes
from itertools import*;print(*min(permutations(input()),key=lambda z:str(z).lower()),sep='')

The best way to sort is clearly to generate all permutations, and then pick the minimum, which just happens to be sorted :)
The strings are lowercased before comparison to abide by the 'case-aware' rules.
Warning: may be very slow with big strings.
An interpreter is located here.

Python 3, 118 bytes
i=input();i,x=map(list,(i,i.lower()))
while x:q=min(x);x.remove(q);q=[q.upper(),q][q in i];i.remove(q);print(q,end="")

Could be golfed much shorter, I know

You can replace if q not in i: with if~-(q in i):.

I do because I'm calling the .remove() function on it.

Powershell, 164 Bytes
I'm sure there's a cleaner way to do this, but I couldn't come up with anything else. Just takes the input as a character array, does an insertion sort, and spits out the output. Loses horribly, even to other non-golfing languages.
Code:
$a=[char[]]($args[0]);For($u=1;$u-lt$a.Count;$u++){$n=$a[$u];$l=$u;while(($l-gt0)-and((""+$a[$l-1]).CompareTo(""+$n)-gt0)){$a[$l]=$a[$l-1];$l--}$a[$l]=$n};$a-join''

Usage:
PS C:\scripts> .\sign-word-2.ps1 tTHhis
hHistT

Expanded & Explained:
$a=[char[]]($args[0])               # Takes command-line argument, recasts as char array
For($u=1;$u-lt$a.Count;$u++){       # Performs a quick-n-dirty insertion sort
  $n=$a[$u]
  $l=$u
  while(($l-gt0)-and((""+$a[$l-1]).CompareTo(""+$n)-gt0)){
  # Ugly, ugly code here. String.CompareTo(String) is case-insensitive, but
  # because we cast as a char[], Char.CompareTo(Char) is case-sensitive ...
  # So, need to do an on-the-fly re-casting as a string with ""+
    $a[$l]=$a[$l-1]
    $l--
  }
  $a[$l]=$n
}
$a-join''             # Without the -join'', it would print out the chars with a space between

Julia, 61 bytes
f=s->s>""?(k=indmax([s...]%32);f(s[k+1:end]s[1:k-1])s[k:k]):s

Julia will display it as a string output if you call it in the REPL. If it has to print out to STDOUT, then it needs 78 bytes:
x->(f=s->s>""?(k=indmax([s...]%32);f(s[k+1:end]s[1:k-1])s[k:k]):s;print(f(x)))

An interpreter for Julia can be found here. Another one, which I've already put some code into, is here. Note that, with the second one, you will need to make the terminal (at the bottom) visible by dragging the boundary up. Clicking "execute" will make it run in the terminal at the normal command line (and thus won't show the output if called without println). Alternatively, you can just type julia into the terminal itself, then handle everything inside the REPL that will come up.
And for a bit of extra fun, here are some other implementations
Gnome Sort (83 bytes):
s->(for m=2:endof(s),n=m:-1:2 s[n]%32<s[n-1]%32&&(s=s[[1:n-2,n,n-1,n+1:end]])end;s)

My own sorting algorithm (84 bytes):
s->(k=1;while length(k)>0 k=find(diff([s...]%32).<0);s=s[setdiff(1:end,k)]s[k]end;s)

Java (JDK 10), 125 bytes
s->{for(int i=s.length,j;i-->1;)for(j=i;j-->0;)s[i]^=(s[i]&95)<(s[j]&95)?s[j]^(s[j]=s[i]):0;System.out.print(new String(s));}

Try it online!
Using a naive sort.

Scala, 82 bytes
print((""/:args(0)){case(s,c)=>val(a,b)=s.span(h=>{if(h<97)32 else 0}+h<c);a+c+b})

from command line:
$ scala -e 'print((""/:args(0)){case(s,c)=>val(a,b)=s.span(h=>{if(h<97)32 else 0}+h<c);a+c+b})' Hello
eHllo

probably can be golfed a bit further...
just implementing insertion sort using fold.

x86 machine code, 51 42 bytes
00000000  b3 82 89 da 8b 07 80 fc  0d 74 12 b9 20 20 09 c1  |.........t..  ..|
00000010  38 e9 7e 06 86 c4 89 07  31 d2 43 eb e7 85 d2 74  |8.~.....1.C....t|
00000020  df c6 47 01 24 b4 09 cd  21 c3                    |..G.$...!.|
0000002a

Bubble sort, with some register reuse tricks to shave bytes here and there; the .COM file runs in DosBox, receives the input from command line and prints the output to standard output.

Commented assembly:
    org 100h

section .text

start:
    ; bubble sort - external loop
ext:
    ; start from the first character (assume bh=0, true on every DOS)
    mov bl,82h
    ; "not-swapped" flag - 82h => no swaps in current iteration;
    ; 0 => a swap happened (the 82h will come in handy later)
    mov dx,bx
    ; bubble sort - internal loop
int:
    ; read 2 characters at time in the full ax
    mov ax,word[bx]   ; al     ah
                      ; ^[bx]  ^[bx+1]
    ; check if we are at the end (the command line is CR terminated)
    cmp ah,0dh
    je skip
    ; make uppercase in cx
    mov cx,2020h
    or cx,ax
    ; compare
    cmp cl,ch
    jle next
    ; wrong order - swap and rewrite
    xchg al,ah
    mov word[bx],ax
    ; mark that we did a swap
    xor dx,dx
next:
    ; next character
    inc bx
    jmp int
skip:
    ; loop as far as we swapped something
    test dx,dx
    jz ext
end:
    ; $-terminate the string
    mov byte[bx+1],'$'
    ; print
    ; dx already contains the location of the string, since that's the
    ; flag value we used for "no swaps"
    mov ah,9
    int 21h
    ret

Perl, 88 bytes
@_=/./g;a:{for(0..@_-2){@_[$_,$_+1]=@_[$_+1,$_],redo a if uc$_[$_]gt uc$_[$_+1]}}print@_

Just a simple Bubble Sort. Call with -n option to pass the text.
e.g:
echo "tThHiIsS" | perl -n sort2.pl

Output:
hHiIsStT

PHP, 106 bytes
The code:
$c=count_chars($argv[1]);$r=str_repeat;for($i=64;++$i<91;)echo$r(chr($i),$c[$i]),$r(chr($i+32),$c[$i+32]);

There is nothing special in the code; count_chars() produces an array indexed by ASCII codes that contains the number of occurrences for each ASCII character. The rest is a dull iteration over this array.
Example of execution:
$ php -d error_reporting=0 sign.php qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKasdfJHGFDSAZXCVBNM
AaaBbCcDddEeFffGgHhIiJjKkLlMmNnOoPpQqRrSssTtUuVvWwXxYyZz

An extra byte can be saved using PHP 7: replace $c[$i] with ($c=count_chars($argv[1]))[$i] and remove the assignment of $c from the beginning of the program.

Haskell, 74 bytes
l=(`mod`32).fromEnum
f=foldr(#)""
e#[]=[e]
e#a@(h:t)|l e<l h=e:a|1<2=h:e#t

Completely different from my other answer. This time it's a simple Insertion sort.

Pip, 18 14 bytes
GitHub repository for Pip
Seems there's no competing with Pyth, but this is pretty respectable.
FcAZ OcQUC_FIa

Works only on strings containing a-zA-Z. For each letter of the alphabet, uses a filter operation to grab the letters from the input string that equal that letter case-insensitively:
                    a <- cmdline arg, AZ <- string containing uppercase alphabet (implicit)
FcAZ                For each character c in AZ:
           FIa      Filter characters of a on the following lambda function:
      UC_           Uppercase of character...
         Qc         ... is equal to c
     O              Output the resulting list, joined on empty string by default

Two notes:

The space is necessary; otherwise, the sequence AZO would scan as A ZO instead of AZ O;
The program doesn't output a trailing newline. To add one, put an x at the end of the code (thereby printing an empty string after the loop is done).

Sample run (using the x variant):
dlosc@dlosc:~/pip$ pip -e "FcAZ OcQUC_FIax" "HelLo wOrld"
deHlLloOrw

05AB1E, 8 bytes
œ.ΔlÇ¥dP

Try it online or verify a few more test cases.
Explanation:
œ         # Get all permutations of the (implicit) input-string
 .Δ       # Find the first permutation which is truthy for:
   l      #  Convert it to lowercase
    Ç     #  Convert each character to its ASCII codepoint
     ¥    #  Get the deltas / forward-differences of those codepoint integer
      d   #  Check that each difference is >= 0
       P  #  And check that all of them are truthy
          # (after which the found string is output implicitly as result)

Japt, 10 bytes
;BíC ËpUèD

Try it
;BíC ËpUèD     :Implicit input of string U
;B             :Uppercase alphabet
  í            :Interleave
; C            :  Lowercase alphabet
     Ë         :Map each D
      p        :  Repeat
       UèD     :    Count of D in U

Perl 5 -a, 31 bytes
for$i(a..z){print grep/$i/i,@F}

Try it online!

Vyxal g, 5 bytes
Ṗ'⇩ÞṠ

Try it Online!
7 bytes without the flag (;h at the end) or 6 bytes flagless (Ṗ‡⇩ÞṠc). This would otherwise output a list of the signature potentially repeated multiple times.
Things that sort things may be out of bounds, but things that check if things are sorted aren't.
Explained
Ṗ'⇩ÞṠ
Ṗ     # From all permutations of the input
 '    # keep only those where:
  ⇩   #   lowercasing the permutation
   ÞṠ #   gives a sorted string

I'm curious as to how Vyxal determines a string is sorted without, in some way, sorting it?

@Shaggy you don't need to sort something to see if it's sorted. You can just check that each overlapping pair is in order.


text:
Zig-zag strings
Zig-zag strings
Given a string and a positive integer, output the string in a zig-zag wave pattern with a peak amplitude and character spacing equal to the integer.
This is similar to this question but also includes character spacing.
Input
Input can be read from STDIN or taken as function arguments. Input is a string without newlines and a positive integer.
Output
Expected output is the string transformed into a zig-zag wave pattern -- starting upwards -- with the first character on the base line. The wave patter must have an amplitude and character spacing equal to the integer.
Examples
Input
Programming Puzzles & Code Golf
2

Output
    o               g                s
  r   g           n                e               e   G
P       r       i       P        l       &       d       o
          a   m           u    z               o           l
            m                z               C               f

Input
Programming Puzzles & Code Golf
1

Output
 r   a   n   u   e       e   l
P o r m i g P z l s & C d   o f
   g   m       z       o   G

This is code golf -- shortest program wins.

Very closely related.

I don't think this is a duplicate of the challenge Martin mentioned, since this challenge has a varying wave size, slightly different rules for making waves, and does not require printing the program's language.

I don't think this is a duplicate either.

I also do not think this is a duplicate

Javascript (ES6), 133 132 136 134 bytes
(s,n,o=Array(2*n+1).fill``)=>[...s].map((v,i)=>o=o.map((w,a)=>w+(a-((j=(i+3*n)%(4*n))>2*n?4*n-j:j)?" ":v)+" ".repeat(n-1)))&&o.join`
`

Defines an anonymous function. To call it, add f= to the beginning to call the function f. Then, it can be tested with console.log(f("Programming Puzzles & Code Golf", 2))

Thanks to @vihan and @edc65 for helping save some bytes! :)
@kvill: The code has been modified to address the variable character spacing requirement in the spec. Didn't notice that at first!

Instead of join and split, you can use keys or fill

Well done, can be 118: (s,n,o=Array(2*n+1).fill'')=>[...s].map((v,i)=>o=o.map((w,a)=>a-((j=(i+3*n)%(4*n))>2*n?4*n-j:j)?w+" ":w+v))&&o.join'' (fill and join using template string with no brackets)

This does not fulfill the specs - character spacing must vary with the size of the integer. See examples.

Python 2, 151
Here is my answer using Python 2:
s,n=input()
a=2*n+1
l,j,o=['',]*a,n,1
for c in s:
 for k in range(a):l[k]+=c+(n-1)*' ' if j==k else' '*n
 j-=o
 if j in [0,2*n]:o=-o
print'\n'.join(l)

Sample output:
         t                                   e                                   h                                   t                                   e
      s     i                             v     ,                             t     e                             s     i                             v
   e           n                       a                                                                       e           n                       a
t                 g                 w                 t                 g                 w                 t                 g                 w
                                                         e           n                       a
                        t     e                             s     i                             v     ,                             t     e
                           h                                   t                                   e                                   h

and
 r   a   n   u   e       e   l
P o r m i g P z l s & C d   o f
   g   m       z       o   G

This does not fulfill the specs - character spacing must vary with the size of the integer. See examples.

updated to include character spacing

J, 75 bytes
f=:4 :0
|:((]*>:@i.@#)((+:<:b)|i.#y){x|.}:(],}.@|.)|.=/~i.b=.>:+:x){' ',y
)

Here is function in use
   7 f'code golf is awesome and I like it'

       l
      o f
     g                           t
          i                     i
   e       s
  d                           e
 o           a               k
c             w             i
               e           l
                s
                 o       I
                  m
                   e   d
                      n
                     a

Nice, but this does not fulfill the specs - character spacing must vary with the size of the integer. See examples.


text:
Puzzle: Factor these 256-bit semiprimes
Challenge
Write a program to factor this set of 10 numbers:
15683499351193564659087946928346254200387478295674004601169717908835380854917
24336606644769176324903078146386725856136578588745270315310278603961263491677
39755798612593330363515033768510977798534810965257249856505320177501370210341
45956007409701555500308213076326847244392474672803754232123628738514180025797
56750561765380426511927268981399041209973784855914649851851872005717216649851
64305356095578257847945249846113079683233332281480076038577811506478735772917
72232745851737657087578202276146803955517234009862217795158516719268257918161
80396068174823246821470041884501608488208032185938027007215075377038829809859
93898867938957957723894669598282066663807700699724611406694487559911505370789
99944277286356423266080003813695961952369626021807452112627990138859887645249

Each of these:

Is a 77-digit number less than 2^256.
Is a semiprime (e.g., the product of exactly 2 primes).
Has something in common with at least one other number in the set.

Thus, this challenge is not about general factoring of 256-bit semiprimes, but about factoring these semiprimes. It is a puzzle. There is a trick. The trick is fun.
It is possible to factor each of these numbers with surprising efficiency. Therefore, the algorithm you choose will make a much bigger difference than the hardware you use.
Rules

This is code-golf, so the shortest answer wins.
You may use any method of factoring. (But don't precompute the answers and just print them. You program should do actual work.)
You may use any programming language (or combination of languages), and any libraries they provide or you have installed. However, you probably won't need anything fancy.

Does our solution have to theoretically work for any general semiprime less that 2^256, or just those?

@BrainSteel — Just these. However, it should actually do some work. Don't simply write a program that executes in 0.00 seconds that prints out the factorizations from hard-coded values after figuring them out using a slower method. :)

You may throw any amount of hardware at the problem. Does that mean you aren't going to time the submissions yourself?

@Dennis — In theory, I'd love to, but in practice, I'd really only be able to time simple C, C++, Java, Perl, or Python solutions. I don't have Haskell, Lisp, Clojure, Mathematica, etc. installed. In any case, throwing even the world's fastest compute cluster at this isn't likely to give the fastest result.

But using the same algorithm on two different computers will. If your not going to test the solutions yourself, the scores will be unverifiable and the contest will boil down to who has the fastest computer. Most languages should be easy enough to install. If you choose this route, I'd recommend forbidding languages without a free interpreter.

All right, I'll test them on my machine if I can. It's a 3.4 GHz 4-core i7.

"But it is possible to do it in the blink of an eye (literally)." - obviously; if you know the solutions already, you can tailor the code to "perform trial division" at "random", but with the seed set to a specific value, or things like that. (EDIT: Note that I do actually already know the 'secret' - it's pretty easy for a mathematician to guess it)

@GlenO Is it? I've tried William's p+1, Pollard's p-1, Fermat's near semi-primes, but none of them matched. To save others the effort, the factorization of the first number is 123830525223423718982054269884856893727 and 126652934104061135988638942588043498971.

My problem with this "challenge" is that as soon as I post my solution, everyone will understand how to do it. @orld - think about the fact that Todd specifically said that you need to do it with this specific set of semiprimes.

I have a solution sitting ready to post, and it runs in milliseconds, but don't want to post it too quickly, because it gives away the puzzle.

@GlenO: This isn't puzzling.SE; IMO go ahead. (This challenge is flawed and doesn't really fit here, and I've downvoted it. It's a fine puzzle, but a horrible [tag:fastest-code] challenge.)

I'm voting to close as lacking an objective winning criterion. After seeing @GlenO's answer, it's obvious that it will be impossible to accurately measure run time.

@Dennis — I had marked this as puzzle-solver originally (also as fastest-code), but someone edited it and removed the tag. I've edited it to change this to a code-golf (shortest answer) problem. Glen's excellent solution is already golfed! :)

@ToddLehman - actually, it's not already golfed. I wrote it on one line because that's how I created it in the REPL, but I'm certain I could cut the length down significantly.

@ToddLehman Close vote retracted. As code golf, this would have been more interesting with a time limit though.

@Dennis — Time limit as in a deadline of submitting answers?

Time limit as in program has to finish before the sun explodes. I don't think you should change it anymore though, as it would invalidate an existing answer.

Pyth, 12 bytes
V.Q--iRN.Q1N

Try it here: Demonstration
Explanation:
               implicit: .Q is the list of the input numbers
V.Q            for N in .Q:
     iRN.Q        compute the gcd of N with each number in .Q
    -     1       remove 1s
   -       N      remove the number N and print

WOW! Unbelievable! Awesome.

I don't know how I could forget about .Q...

Julia
f=l->(A=map(big,[gcd(l[i],l[j]) for i=1:length(l),j=1:length(l)]);A-=eye(A).*(l-1);for i=1:length(l) println(l[i]," = ",join(unique(A[i,:])," × "))end);

Running it:
julia> tic();f(l);toc()
15683499351193564659087946928346254200387478295674004601169717908835380854917 = 1 × 123830525223423718982054269884856893727 × 126652934104061135988638942588043498971
24336606644769176324903078146386725856136578588745270315310278603961263491677 = 123830525223423718982054269884856893727 × 1 × 196531562802139162910711939551924590851
39755798612593330363515033768510977798534810965257249856505320177501370210341 = 126652934104061135988638942588043498971 × 1 × 313895598975456800331958744266933545471
45956007409701555500308213076326847244392474672803754232123628738514180025797 = 1 × 196531562802139162910711939551924590851 × 233835251470362519313085185758275325847
56750561765380426511927268981399041209973784855914649851851872005717216649851 = 1 × 218051709768607497734800854124975705007 × 260261943488556401874345256435550440693
64305356095578257847945249846113079683233332281480076038577811506478735772917 = 1 × 218051709768607497734800854124975705007 × 294908745103709254641398276907437631131
72232745851737657087578202276146803955517234009862217795158516719268257918161 = 1 × 233835251470362519313085185758275325847 × 308904433345854212511531098349325333463
80396068174823246821470041884501608488208032185938027007215075377038829809859 = 1 × 260261943488556401874345256435550440693 × 308904433345854212511531098349325333463
93898867938957957723894669598282066663807700699724611406694487559911505370789 = 1 × 294908745103709254641398276907437631131 × 318399740590727338211743341325021840319
99944277286356423266080003813695961952369626021807452112627990138859887645249 = 1 × 313895598975456800331958744266933545471 × 318399740590727338211743341325021840319
elapsed time: 0.002534739 seconds

Note: Because of how Julia operates, you might want to run it twice - the first time you run it, the tic/toc will include the time required to "compile" it. The second time, it will have already compiled it.

Nice work! Much shorter than my Perl solution.

CJam, 32 bytes
q~]__ff{{_@\%}h}:|1-_m*_::*\er:p

Try it online: permalink for Chrome | permalink for Firefox

CJam, 38 bytes
q~]_2m*{~{_@\%}h;}%_2$-&2m*f{_::*@#=p}

Try it here.
This answer is shorter than any of the factors in the output.

Hahaha, holy smokes, that's impressive. I may have to learn CJam now. That's just...wow. Best part is, the trick isn't visible from eyeballing the code! :)

J, 2 bytes
This is code-golf now, so I assume efficiency doesn't actually matter, which means:
q:

(J's "factor prime" function) will return the right answer (in the form of a neatly formatted 2x10 array!) if you pass it an array of bignums give it a couple of hours/days to factor the semiprimes.

LOL. Welp, I hadn't anticipated that loophole! :-o :-)

@ToddLehman I wouldn't call this a loophole per se

Pyth, 15 13 12 bytes
jbmS{iLd.Q.Q

Expects the list of primes seperated by newlines on stdin. Outputs in the following format:
[1, 123830525223423718982054269884856893727, 126652934104061135988638942588043498971, 15683499351193564659087946928346254200387478295674004601169717908835380854917]
[1, 123830525223423718982054269884856893727, 196531562802139162910711939551924590851, 24336606644769176324903078146386725856136578588745270315310278603961263491677]
[1, 126652934104061135988638942588043498971, 313895598975456800331958744266933545471, 39755798612593330363515033768510977798534810965257249856505320177501370210341]
[1, 196531562802139162910711939551924590851, 233835251470362519313085185758275325847, 45956007409701555500308213076326847244392474672803754232123628738514180025797]
[1, 218051709768607497734800854124975705007, 260261943488556401874345256435550440693, 56750561765380426511927268981399041209973784855914649851851872005717216649851]
[1, 218051709768607497734800854124975705007, 294908745103709254641398276907437631131, 64305356095578257847945249846113079683233332281480076038577811506478735772917]
[1, 233835251470362519313085185758275325847, 308904433345854212511531098349325333463, 72232745851737657087578202276146803955517234009862217795158516719268257918161]
[1, 260261943488556401874345256435550440693, 308904433345854212511531098349325333463, 80396068174823246821470041884501608488208032185938027007215075377038829809859]
[1, 294908745103709254641398276907437631131, 318399740590727338211743341325021840319, 93898867938957957723894669598282066663807700699724611406694487559911505370789]
[1, 313895598975456800331958744266933545471, 318399740590727338211743341325021840319, 99944277286356423266080003813695961952369626021807452112627990138859887645249]

Pyth, 4 bytes
Since we don't have to abuse the common divisors we can simply use the factorization function and map it to the input:
PM.Q

Yay loopholes!