view letersort @ 5849:a741d9c7ba85

<oren> ` cat <<<\'\xe3\x81\x9f\xe3\x81\xa8\xe3\x81\x88\xe3\x81\xb0\xe3\x81\x93\xe3\x81\xae\xe3\x83\xa1\xe3\x82\xbb\xe3\x83\xbc\xe3\x82\xb8\' >testbegin
author HackBot
date Sat, 18 Jul 2015 22:25:42 +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;}}}