Advertisement
PetyoKamenov

Untitled

Jun 16th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3.  
  4. public class HouseCord {
  5. public static void main(String[] args) {
  6. Scanner input = new Scanner(System.in);
  7. char[] letters = input.next().toCharArray();
  8. if (letters.length == 3) {
  9. for (int a = 0; a < 3; a++) {
  10. for (int b = 0; b < 3; b++) {
  11. for (int c = 0; c < 3; c++) {
  12. System.out.printf("%s%s%s ",letters[a],letters[b],letters[c]);
  13. }
  14. }
  15. }
  16. }
  17. else if (letters.length == 2) {
  18. for (int a = 0; a < 2; a++) {
  19. for (int b = 0; b < 2; b++) {
  20. for (int c = 0; c < 2; c++) {
  21. System.out.printf("%s%s%s ",letters[a],letters[b],letters[c]);
  22. }
  23. }
  24. }
  25. }
  26. else {
  27. System.out.printf("%s%s%s",letters[0],letters[0],letters[0]);
  28. }
  29. System.out.println();
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement