cokefag Master Cheater
Reputation: 51
Joined: 15 Nov 2007 Posts: 488
|
Posted: Tue Dec 01, 2015 2:20 am Post subject: autism |
|
|
| Code: | public class Main{
public static void main(String[] args){
String meme = "WEWLAD";
int length_with_spaces = meme.length() * 2 - 1;
for (int x = 0; x < length_with_spaces + 1; ++x){
// top
if (x == 0){
System.out.print(meme.charAt(meme.length() - 1));
for (int y = 0; y < length_with_spaces - 2; ++y){
System.out.print(" ");
}
for (int z = 0; z < meme.length(); ++z){
System.out.print(meme.charAt(z));
if (z != meme.length()){
System.out.print(" ");
}
}
System.out.print("\n");
}
// bottom
else if (x == length_with_spaces){
for (int y = 0; y < meme.length(); ++y){
System.out.print(meme.charAt(meme.length() - 1 - y));
if (y != meme.length() - 1){
System.out.print(" ");
}
}
for (int z = 0; z < length_with_spaces - 2; ++z){
System.out.print(" ");
}
System.out.print(meme.charAt(meme.length() - 1));
System.out.print("\n");
}
// middle
else if (x == meme.length()){
for (int y = 0; y < length_with_spaces; ++y){
if (y < meme.length()){
System.out.print(meme.charAt(y) + " ");
}
else if (y == meme.length() - 1){
System.out.print(meme.charAt(y));
}
else if (y < length_with_spaces - 1){
System.out.print(meme.charAt(meme.length() - (y + 1 - meme.length()) - 1) + " ");
}
else {
System.out.print(meme.charAt(meme.length() - (y + 1 - meme.length()) - 1) + "\n");
}
}
}
// top half
else if (x < meme.length() - 1){
System.out.print(meme.charAt((meme.length() - 1) - x));
for (int y = 0; y < length_with_spaces - 2; ++y){
System.out.print(" ");
}
System.out.print(meme.charAt(x) + "\n");
}
// bottom half
else if (x > meme.length()){
for (int z = 0; z < length_with_spaces - 1; ++z){
System.out.print(" ");
}
System.out.print(meme.charAt((meme.length() - 1) - (x - meme.length())));
for (int y = 0; y < length_with_spaces - 2; ++y){
System.out.print(" ");
}
System.out.print(meme.charAt(x - meme.length()) + "\n");
}
}
}
} |
|
|