mramine364

aaa...zzz

Apr 30th, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.36 KB | None | 0 0
  1. public class P{
  2.     public static void main(String[] args){
  3.         p(3);
  4.     }
  5.  
  6.     private static void p(int n){
  7.         p("", n);
  8.     }
  9.  
  10.     private static void p(String s, int n){
  11.         if(n>1){
  12.             for(int i=0;i<26;i++){
  13.                 p(s+Character.toChars(97+i)[0], n-1);
  14.             }
  15.         }else{
  16.             for(int i=0;i<26;i++){
  17.                 System.out.println( s+Character.toChars(97+i)[0] );
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment