import java.util.Scanner;

public class StrangeStringStuff {
  /* returns true if both words have the same contents
   * or false otherwise */
  public static boolean same(String word1, String word2) {
    if (word1.length() != word2.length()) {
      return false;
    }

    /* compare letter by letter */
    for (int i = 0; i < word1.length(); i++) {
      if (word1.charAt(i) != word2.charAt(i)) {
        return false;
      }
    }

    return true;
  }

  public static boolean sameIgnoreCase(String word1, String word2) {
    return same(word1.toUpperCase(), word2.toUpperCase());
  }
  
  public static void main(String []args) {
    String myFriend = "Spongebob";

    Scanner in = new Scanner(System.in);
    System.out.print("What's your name? ");
    String name = in.next();

    /* comparing locations, not the contents:
       called a "shallow comparison" */
    if (name == myFriend) {
      System.out.println("same");
    } else {
      System.out.println("different");
    }

    System.out.println(name.length());
    System.out.println(myFriend.length());

    /* comparing contents, not just the locations:
       called a "deep comparison" */
    if (same(name, myFriend)) {
      System.out.println("same");
    } else {
      System.out.println("different");
    }

    if (sameIgnoreCase(name, myFriend)) {
      System.out.println("same");
    } else {
      System.out.println("different");
    }
  }
}
