Untitled
Never
#include <stdio.h> #include <string.h> char given_list[20]; //use given_list to store the input char password[20]; //use passward to store the output int len; void list(); void perm(int pos,int start,int end); //pos is for the currant position of password[] //start~end is for the range of given_list[] int main(void){ scanf("%s",given_list); len=strlen(given_list); list(); perm(0,0,len-1); return 0; } void perm(int pos,int start,int end){ int i; //printf("start:%d\n",start); //basic step if(pos>=4 && pos<=len){ for(int j=0;j<pos;j++) printf("%c",password[j]); if(password[0]!=given_list[(len-4)]) printf(","); else printf("\n"); } //recursive step for(i=start;i<=end;i++){ password[pos]=given_list[i]; //printf("pos:%d %c ",pos,password[pos]); perm(pos+1,i+1,end); } } /*******bubble sort*******/ void list(void){ char temp; for(int i=0;i<len-1; i++) { for (int j=0; j<len-1-i;j++) { if (given_list[j]>given_list[j+1]) { temp=given_list[j]; given_list[j]=given_list[j + 1]; given_list[j+1]=temp; } } } }
Raw Text
-
10 Strategies for Healthy and Sustainable Weight Loss
18 sec ago
-
Essential Keto Gummies Australia(2024) 100% Safe, Does It Really Work Or Not?
2 min ago
-
https://www.facebook.com/GetHempSmartCBDGummieAU/
13 min ago
-
ughser
29 min ago
-
oiuoiot
45 min ago
-
Tudum
48 min ago
-
semaphore
49 min ago
-
semaphore
51 min ago
-
semaphore
55 min ago
-
to pranavvvvvvvvvv
56 min ago