-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeforces.java
More file actions
32 lines (24 loc) · 883 Bytes
/
Codeforces.java
File metadata and controls
32 lines (24 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.*;
import java.io.*;
public class Codeforces{
public static void main(String [] args)throws IOException{
/*BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
while(t-->0){
int n=Integer.parseInt(br.readLine());
String s[]=br.readLine().split(" ");
}// while ends*/
ArrayList<String> arr=new ArrayList<String>();
sub("ABCD",arr,0,"");
System.out.println(arr.toString());
}// main ends
static void sub(String str,ArrayList<String> arr,int k,String as){
if(str.length()==k+1){ //notice the value of k
arr.add(as);
arr.add(as+str.charAt(k));
return ;
}
sub(str,arr,k+1,as);
sub(str,arr,k+1,as+str.charAt(k));
}
}