R、195文字
A=strsplit(scan(,""),"")[[1]];cat(A[order(sapply(A,function(x){png('a',a='none',fa='monospace');frame();text(0,0,x);dev.off();sum(apply(png::readPNG('a'),c(1,2),function(x)any(x!=1)))}))],sep="")
コメントでインデント:
A=strsplit(scan(,""),"")[[1]] #Take characters as strings and split into single chars
cat(A[order(sapply(A,function(x){ #Apply the following function to each char and order accordingly
png('a',a='none',fa='monospace'); #Open empty png without antialiasing and with monospace font
frame(); #create empty plot
text(0,0,x); #add the char as text to the plot
dev.off(); #close png device
sum(apply(png::readPNG('a'), #read it back as rbga 3d matrix
c(1,2), #check every layer (R, G, B, A)
function(x)any(x!=1))) #if any are not 1, send TRUE
}))], #Sum all TRUEs
sep="") #Prints to output
例:
> A=strsplit(scan(,""),"")[[1]];cat(A[order(sapply(A,function(x){png('a',a='none',fa='monospace');frame();text(0,0,x);dev.off();sum(apply(png::readPNG('a'),c(1,2),function(x)any(x!=1)))}))],sep="")
1: @+.0
2:
Read 1 item
.+0@
> A=strsplit(scan(,""),"")[[1]];cat(A[order(sapply(A,function(x){png('a',a='none',fa='monospace');frame();text(0,0,x);dev.off();sum(apply(png::readPNG('a'),c(1,2),function(x)any(x!=1)))}))],sep="")
1: 1234567890
2:
Read 1 item
1723450689
Rプロットでのフォントの配置はプラットフォームに依存するため、PCで動作することを保証できませんが、Mac(OS X 10.7.5、R 2.14.2)では動作します。