Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- void wtf() {
- FILE *f = fopen("input.txt", "w");
- char c;
- while((c = getchar()) != EOF) {
- fputc(c, f);
- }
- fclose(f);
- }
- int main() {
- // wtf();
- FILE *vlez = fopen("input.txt", "r");
- char niza[200];
- while(fgets(niza, 100, vlez) != NULL) {
- int kolku_cifri = 0;
- char cifri[200];
- for(int i = 0; i < strlen(niza); i++) {
- if(isdigit(niza[i])) {
- cifri[kolku_cifri] = niza[i];
- kolku_cifri++;
- }
- }
- for(int i = 0; i < kolku_cifri; i++) {
- for(int j = i + 1; j < kolku_cifri; j++) {
- if(cifri[i] > cifri[j]) {
- char pom = cifri[i];
- cifri[i] = cifri[j];
- cifri[j] = pom;
- }
- }
- }
- printf("%d", kolku_cifri);
- printf(":");
- for(int i = 0; i < kolku_cifri; i++) {
- printf("%c", cifri[i]);
- }
- printf("\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment