Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class P{
- public static void main(String[] args){
- p(3);
- }
- private static void p(int n){
- p("", n);
- }
- private static void p(String s, int n){
- if(n>1){
- for(int i=0;i<26;i++){
- p(s+Character.toChars(97+i)[0], n-1);
- }
- }else{
- for(int i=0;i<26;i++){
- System.out.println( s+Character.toChars(97+i)[0] );
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment