import java.util.Scanner;

public class Truncate {

  public static String truncate(String s, int len) {
    if(s.length() < len) {
      return s;
    }
    else {
      return s.substring(0, len) + "...";
    }
  }

  public static void main(String[] args) {
    // Which example will read input from the user,
    // truncate it, and print the truncated version?

    // A:
    //Scanner scan = new Scanner(System.in);
    //String s = scan.nextLine();
    //truncate(s, 10);

    // B:
    // Scanner scan = new Scanner(System.in);
    // String s = scan.nextLine();
    // System.out.println(truncate(s, 10));


    // C:
    //Scanner scan = new Scanner(System.in);
    //String s = scan.nextLine();
    //truncate(s, 10);
    //System.out.println(s);

    // D:
    //Scanner scan = new Scanner(System.in);
    //String s = scan.nextLine();
    //String truncated = truncate(s, 10);
    //System.out.println(truncated);
  }

}

    // Example 1:

    // Which one of these prints "a..."?

    // A:
    // System.out.println(String.truncate("abcd", 1));

    // B:
    // String s = "abcd";
    // System.out.println(s.truncate("abcd", 1));

    // C:
    // System.out.println(truncate("abcd", 1));

    // String s = "abcd";
    // System.out.println(truncate(s, 1));

    // D:
    // String s = "abcd";
    // truncate(s, 1);
    // What does this print?

/*
    String s = "A longish string";
    // s - variable that holds a string
    // trunc - variable that holds a string
    // String trunc = truncate(s, 6);
    String trunc = Truncate.truncate(s, 6);
    String bigTrunc = trunc.toUpperCase();
    System.out.println(bigTrunc);
*/
    /* A:
          A LONG...

       B:
          A long...
          A LONG...
          A LONG...

       C: It prints something else

       D: It's an error
       */
