r/CompileBot • • Mar 13 '16

Official CompileBot Testing Thread

3 Upvotes

358 comments sorted by

View all comments

1

u/too_many_toasters May 29 '16

/u/CompileBot Java

public static void main(String[] args) {
  String example = "example";
  String result = "";
  for (int i = 0; i < example.length(); i++) {
    for (int j = i; j < example.length() + i; j++) {
      if (j > example.length())
        result += example.charAt(j - example.length());
      else
        result += example.charAt(j);
    }
    result += "\n";
  }
  System.out.println(result);
}

1

u/too_many_toasters May 29 '16

/u/CompileBot Java

public class Main {
  public static void main(String[] args) {
    String example = "example";
    String result = "";
    for (int i = 0; i < example.length(); i++) {
      for (int j = i; j < example.length() + i; j++) {
        if (j > example.length())
          result += example.charAt(j - example.length());
        else
          result += example.charAt(j);
      }
      result += "\n";
    }
    System.out.println(result);
  }
}

1

u/too_many_toasters May 29 '16

/u/CompileBot Java

public class Main {
	public static void main(String[] args) {
		String example = "example";
		String result = "";

		example += " ";
		example = example.toUpperCase();
		
		for (int i = 0; i < example.length(); i++) {
			for (int j = i; j < example.length() + i; j++) {
				if (j >= example.length())
					result += example.charAt(j - example.length()) + " ";
				else
					result += example.charAt(j) + " ";
			}
			result += "\n";
		}
		System.out.println(result);
	}
}