Mercurial > repo
view letersort @ 6000:ec72a2ec47e9
<hppavilion[1]> le/rn wisdome/The place where all of HackBot\'s wisdom is stored and forced to fight to the death for the freedom of being printed out when you type `wisdom
author | HackBot |
---|---|
date | Tue, 15 Sep 2015 23:32:28 +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;}}}