view letersort @ 6249:0ed3e029eef5

<b_jonas> learn The Daystar is an unscientific myth of a bright orb glowing in the sky outside only at the times you\'re in your office.
author HackBot
date Mon, 23 Nov 2015 11:10:58 +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;}}}