Problem:
Score: 200 points

Problem Statement

We have a string S consisting of lowercase English letters.

If the length of S is at most K, print S without change.

If the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.

Constraints

K is an integer between 1 and 100 (inclusive).

S is a string consisting of lowercase English letters.

The length of S is between 1 and 100 (inclusive).

Input

Input is given from Standard Input in the following format:

K
S

Output

Print a string as stated in Problem Statement.

Sample Input 1

7
nikoandsolstice

Sample Output 1

nikoand...

nikoandsolstice has a length of 15, which exceeds K=7.

We should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....

Sample Input 2

40
ferelibenterhominesidquodvoluntcredunt

Sample Output 2

ferelibenterhominesidquodvoluntcredunt

The famous quote from Gaius Julius Caesar.

Solution in C# (Mono-csc 3.5.0) (judge verdict: Accepted)

using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
  class Program
  {
    static void Main(string[] args)
    {
      ABC168.B();
    }
    class ABC168
    {
      public static void A()
      {
        var N = Read.Int();
        switch (N % 10)
        {
          case 0:
          case 1:
          case 6:
          case 8:
            Console.WriteLine("pon");return;
          case 3:
            Console.WriteLine("bon");return;
          case 2:
          case 4:
          case 5:
          case 7:
          case 9:
            Console.WriteLine("hon");return;
        }
      }
      public static void B()
      {
        var K = Read.Int();
        var S = Read.Str();
        Console.WriteLine(S.Length <= K ? S : S.Substring(0, K) + "...");
      }
      public static void C()
      {
        var A = Read.Int();
        var B = Read.Int();
        var H = Read.Int();
        var M = Read.Int();
        var r1 = Math.PI * (H * 60 + M) / 360;
        var r2 = Math.PI * M / 30;
        var x1 = Math.Cos(r1) * A;
        var y1 = Math.Sin(r1) * A;
        var x2 = Math.Cos(r2) * B;
        var y2 = Math.Sin(r2) * B;
        Console.WriteLine(Math.Sqrt(Math.Max(0, (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2))));
      }
      public static void D()
      {
        var N = Read.Int();
        var M = Read.Int();
        var Adj = Read.AdjacencyList(N, M);
        var ans = Enumerable.Range(0, N + 1).Select(i => -1).ToArray();
        var queue = new Queue<int>();
        queue.Enqueue(1);
        while (queue.Count > 0)
        {
          var v = queue.Dequeue();
          foreach(var w in Adj[v])
          {
            if (ans[w] >= 0) { continue; }
            ans[w] = v;
            queue.Enqueue(w);
          }
        }
        if (ans.Skip(2).Count(x => x < 0) > 0) { Console.WriteLine("No"); return; }
        Console.WriteLine("Yes");
        Console.WriteLine(String.Join(Environment.NewLine, ans.Skip(2)));
      }
      public static void E()
      {
        var N = Read.Int();
        var AB = Read.TupleLong(N);
        var Zero = new List<Tuple<long, long>>();
        var D1 = new List<Tuple<long, long>>();
        var D2 = new List<Tuple<long, long>>();

        var count1 = new Dictionary<long, Dictionary<long, long>>();
        var count2 = new Dictionary<long, Dictionary<long, long>>();

        foreach (var t in AB)
        {
          var X = t.Item1;
          var Y = t.Item2;
          if (X == 0 && Y == 0) { Zero.Add(new Tuple<long, long>(0, 0)); continue; }
          if (Y < 0)
          {
            X *= -1;
            Y *= -1;
          }
          var gcd = Util.GCD(Math.Abs(X), Y);
          X /= gcd;
          Y /= gcd;
          if (X >= 0)
          {
            if (!count1.ContainsKey(X)) { count1.Add(X, new Dictionary<long, long>()); }
            if (!count1[X].ContainsKey(Y)) { count1[X].Add(Y, 0); }
            count1[X][Y]++;
          }
          else
          {
            if (!count2.ContainsKey(X)) { count2.Add(X, new Dictionary<long, long>()); }
            if (!count2[X].ContainsKey(Y)) { count2[X].Add(Y, 0); }
            count2[X][Y]++;
          }
        }

        MOD two = 2;
        MOD ans = 1;
        foreach(var kvp1 in count1)
        {
          foreach(var kvp2 in kvp1.Value)
          {
            var X = kvp1.Key;
            var Y = kvp2.Key;
            var C = kvp2.Value;
            if (count2.ContainsKey(-Y) && count2[-Y].ContainsKey(X))
            {
              var C2 = count2[-Y][X];
              count2[-Y][X] = 0;
              ans = ans * (two.Power(C) + two.Power(C2) - 1);
            }
            else
            {
              ans = ans * (two.Power(C) - 0);
            }
          }
        }
        foreach (var kvp1 in count2)
        {
          foreach (var kvp2 in kvp1.Value)
          {
            ans = ans * two.Power(kvp2.Value);
          }
        }
        Console.WriteLine((ans + Zero.Count - 1).V);
      }
      public static void F()
      {

      }
    }


    class Util
    {
      public static long[] ASum(long[] array)
      {
        var res = new long[array.Length + 1];
        for (int i = 0; i < array.Length; ++i)
        {
          res[i + 1] = res[i] + array[i];
        }
        return res;
      }
      public static Dictionary<T, long> Frequency<T>(T[] array)
      {
        var dict = new Dictionary<T, long>();
        foreach (var a in array)
        {
          if (!dict.ContainsKey(a)) { dict.Add(a, 0); }
          dict[a]++;
        }
        return dict;
      }
      public static long GCD(long a, long b)
      {
        while (b > 0)
        {
          var c = a % b;
          a = b;
          b = c;
        }
        return a;
      }
    }
    struct MOD
    {
      public static long P = 1000000007;
      public readonly long V;

      public MOD(long a) { this.V = a % P; }
      public static implicit operator MOD(long a) { return new MOD(a); }
      public static MOD operator +(MOD a, MOD b) { return new MOD((a.V + b.V) % P); }
      public static MOD operator -(MOD a, MOD b) { return new MOD((a.V - b.V + P) % P); }
      public static MOD operator *(MOD a, MOD b) { return new MOD((a.V * b.V) % P); }
      public static MOD operator /(MOD a, MOD b) { return new MOD((a.V * b.Inverse().V) % P); }
      public MOD Inverse()
      {
        long a = V, p = P; long b = p, c = 1, d = 0, e = 0, f = 0;
        while (b != 0) { e = a / b; f = b; b = a - e * b; a = f; f = d; d = c - e * d; c = f; }
        c %= p;
        return c + (c < 0 ? p : 0);
      }
      public MOD Power(long n)
      {
        long a = V, p = P; long res = 1; long mult = a;
        for (int i = 0; i < 63; ++i) { if ((n & ((long)1 << i)) > 0) { res = (res * mult) % p; } mult = (mult * mult) % p; }
        return res;
      }
      public override string ToString() { return V.ToString(); }
    }


    static class Read
{
static Queue<string> queue = new Queue<string>();
static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
public static ulong[] ULongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToUInt64(s)).ToArray(); }
public static string[] StrN() { return Console.ReadLine().Split(' '); }
public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
public static long[,] LongMatrix(int r, int c) { var mat = new long[r, c]; for (int i = 0; i < r; ++i) { var x = Read.LongN(); for (int j = 0; j < c; ++j) { mat[i, j] = x[j]; } } return mat; }
public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M, bool isDirectional = false)
{
Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
for (int i = 0; i <= N; ++i) { dict.Add(i, new HashSet<int>()); }
        for (int i = 0; i < M; ++i) { var ab = Read.IntN(); if (!dict[ab[0]].Contains(ab[1])) { dict[ab[0]].Add(ab[1]); } if (!isDirectional && !dict[ab[1]].Contains(ab[0])) { dict[ab[1]].Add(ab[0]); } }
        return dict;
}
public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
{
Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>(); for (int i = 0; i <= N; ++i) { dict.Add(i, new Dictionary<int, long>()); }
for (int i = 0; i < M; ++i) { var ab = Read.IntN(); dict[ab[0]].Add(ab[1], ab[2]); dict[ab[1]].Add(ab[0], ab[2]); }
return dict;
}
}
    }
}