Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class kingOfThieves260415m {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- String symbol = scan.nextLine();
- int tire = n / 2;
- int count = 1;
- for (int i = 0; i < n; i++){
- System.out.println(doMagic("-", tire) + doMagic(symbol, count) + doMagic("-", tire));
- if (i < n / 2){
- tire--;
- count += 2;
- }else{
- tire++;
- count -= 2;
- }
- }
- }
- static String doMagic(String strToRepeat, int count) {
- String text = "";
- for (int i = 0; i < count; i++) {
- text = text + strToRepeat;
- }
- return text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement