61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
|
#include <string.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
// void concatForEach(char *a, char *b, char *target ) {
|
||
|
// int lenA = strlen(a);
|
||
|
// int lenB = strlen(b);
|
||
|
|
||
|
// // We use the smaller one
|
||
|
// char *using = lenA > lenB ? b : a;
|
||
|
// int usingLen = lenA > lenB ? lenB : lenA;
|
||
|
|
||
|
// int i;
|
||
|
// for (i=0; i < usingLen; i+=2) {
|
||
|
// target[i] = a[i];
|
||
|
// target[i+1] = b[i];
|
||
|
// }
|
||
|
|
||
|
// // Now we use the bigger one
|
||
|
// char *new = lenA > lenB ? a : b;
|
||
|
// int newLen = lenA > lenB ? lenA : lenB;
|
||
|
|
||
|
// for (; i < newLen-usingLen; i++) {
|
||
|
// target[i] = a[i];
|
||
|
// }
|
||
|
|
||
|
// return;
|
||
|
|
||
|
// }
|
||
|
|
||
|
int main(int argc, char **argv) {
|
||
|
char ann[100];
|
||
|
char ben[100];
|
||
|
|
||
|
scanf("%s", ann);
|
||
|
scanf("%s", ben);
|
||
|
|
||
|
char total[200];
|
||
|
|
||
|
// Concatenate
|
||
|
strcat(total, ann);
|
||
|
strcat(total, ben);
|
||
|
|
||
|
// Alphabetical sort
|
||
|
int len = strlen(total);
|
||
|
int i, j;
|
||
|
for (i=0; i < len; i++) {
|
||
|
for (j=0; j < len-i-1; j++) {
|
||
|
if (total[j] > total[j+1]) {
|
||
|
char temp = total[j];
|
||
|
total[j] = total[j+1];
|
||
|
total[j+1] = temp;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for (i=0; i < len; i++) {
|
||
|
printf("%c", total[i]);
|
||
|
}
|
||
|
printf("\r\n");
|
||
|
return 0;
|
||
|
}
|