view letersort @ 5983:e9e46956a506

<oerjan> mk wisdom/welcome.sv//Hej och v\xc3\xa4lkommen till den internationella knutpunkten f\xc3\xb6r esoterisk programmeringsspr\xc3\xa5ksdesign och -drifts\xc3\xa4ttning! F\xc3\xb6r mer information, se v\xc3\xa5r wiki: <http://esolangs.org/>. (F\xc3\xb6r den andra sortens esoterism, pr\xc3\xb6va #esoteric p\xc3\xa5 EFnet eller DALnet.)
author HackBot
date Mon, 14 Sep 2015 17:49:06 +0000
parents a5ef8d072826
children
line wrap: on
line source

#include <stdio.h>
int compare(char *s,char *c){return*c-*s;}int main(){char w[40];int c,i=0;while(
1){c=getchar();if(c<=32||c==EOF){qsort(w,i,1,compare);w[i]=0;printf("%s",w);if(c
==EOF)break;putchar(c);i=0;}else{w[i++]=c;}}}