import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

/**
 * @author Andrei Chugunov
 */
public class Main {

    private static class Solution {
        private void solve(FastScanner in, PrintWriter out) {
            int t = in.nextInt();
            for(int i = 0; i < t; i++) {
                int n = in.nextInt();
                int m = in.nextInt();
                int[] a = in.nextIntArray(n);
                int sum = 0;
                for (int k = 0; k < n; k++) {
                    sum+=a[k];
                }
                if (sum == m) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            }

        }
    }

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Solution solver = new Solution();
        solver.solve(in, out);
        out.flush();
        //out.close();
    }

    private static class ArrayUtils {
        private static final long seed = System.nanoTime();
        private static final Random rand = new Random(seed);

        private static void sort(int[] a) {
            shuffle(a);
            Arrays.sort(a);
        }

        private static void shuffle(int[] a) {
            for (int i = 0; i < a.length; i++) {
                int j = rand.nextInt(i + 1);
                int t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
        }

    }

    private static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        FastScanner(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream), 32768);
            st = null;
        }

        private String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        private int nextInt() {
            return Integer.parseInt(next());
        }

        private long nextLong() {
            return Long.parseLong(next());
        }

        private int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }
    }
}


import java.io.*;
import java.util.*;

// CodeForces :
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Problem solver = new Problem();
        int tt = in.nextInt();
        solver.solve(tt, in, out);
        out.close();
    }

    static class Problem {
        public void solve(int tt, InputReader in, OutputWriter out) {
            while (tt-- > 0) {
                int n = in.nextInt();
                int m = in.nextInt();
                int a[] = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = in.nextInt();
                }
                int sum = 0;
                for (int i = 0; i < n; i++) {
                    sum += a[i];
                }
                if (sum == m) {
                    out.println("YES");
                } else {
                    out.println("NO");
                }
            }
        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(String fileName) throws FileNotFoundException {
            super(fileName);
        }

        public OutputWriter(OutputStream outputStream) {
            super(outputStream);
        }

        public OutputWriter(Writer writer) {
            super(writer);
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer in;

        public InputReader(String fileName) {
            try {
                br = new BufferedReader(new FileReader(fileName));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
        }

        boolean hasMoreTokens() {
            while (in == null || !in.hasMoreTokens()) {
                String s = nextLine();
                if (s == null) {
                    return false;
                }
                in = new StringTokenizer(s);
            }
            return true;
        }

        public String nextString() {
            return hasMoreTokens() ? in.nextToken() : null;
        }

        public String nextLine() {
            try {
                in = null;
                return br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
                return null;
            }
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public int[][] nextIntIntArray(int n, int m) {
            int[][] a = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[i][j] = nextInt();
                }
            }
            return a;
        }

    }
}


import java.util.Scanner;

public class trial_1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int it = in.nextInt();
        for(int iteration=0; iteration<it; iteration++) {
            int n = in.nextInt(), m = in.nextInt();
            int[] arr = new int[n];
            for(int i=0; i<n; i++) {
                arr[i] = in.nextInt();
            }
            int x=0;
            for(int i=0; i<n; i++) {
                x = x + arr[i];
            }
            //System.out.println("x= " + x);
            if(x==m) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


import java.util.Scanner;

public class Reorder {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int it = in.nextInt();
        for(int iteration=0; iteration<it; iteration++) {
            int n = in.nextInt(), m = in.nextInt();
            int[] arr = new int[n];
            for(int i=0; i<n; i++) {
                arr[i] = in.nextInt();
            }
            int x=0;
            for(int i=0; i<n; i++) {
                x = x + arr[i];
            }
            if(x==m) System.out.println("YES");
            else System.out.println("NO");
        }
        in.close();
    }
}


import java.util.*;

public class A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; ++i) {
            int n = sc.nextInt();
            int[] a = new int[n];
            int m = sc.nextInt();
            int sum = 0;
            for (int j = 0; j < n; ++j) {
                a[j] = sc.nextInt();
                sum += a[j];
            }
            if (sum == m) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


import java.util.*;

public class A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; ++i) {
            int n = sc.nextInt();
            int[] a = new int[n];
            int m = sc.nextInt();
            int sum = 0;
            for (int j = 0; j < n; ++i) {
                a[j] = sc.nextInt();
                sum += a[j];
            }
            if (sum == m) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


import java.util.*;

public class A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        for (int i = 0; i < t; ++i) {
            int n = sc.nextInt();
            int[] a = new int[n];
            int m = sc.nextInt();
            int sum = 0;
            for (int j = 0; j < n; ++i) {
                a[i] = sc.nextInt();
                sum += a[i];
            }
            if (sum == m) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        // int t = 1;

        while (t-- > 0) {
            int n = in.nextInt();
            int x = in.nextInt();
            ArrayList<Integer> arr = new ArrayList<>();
            for (int i = 0; i < n; ++i) {
                arr.add(in.nextInt());
            }
            double sum = 0;
            // Collections.sort(arr);
            for (int i = 0; i < n; ++i) {
                for (int j = i; j < n; ++j) {
                    sum = sum + (((double)arr.get(j))/(j+1));
                }
            }
            sum = Math.ceil(sum);
            if ((int)sum == x) System.out.println("YES");
            else System.out.println("NO");
        }

        in.close();
    }
}

// -- Templates --
// System.out.println();
// System.out.print();
// for (int i = 0; i < n; ++i)
// Map<> map = new HashMap<>();


import java.util.Scanner;

public class P1436A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        //int t = 1;

        while (t-- > 0) {
            int n = in.nextInt();
            int x = in.nextInt();
            long sum = 0;
            for (int i = 0; i < n; ++i)
                sum += (long)in.nextInt();

            if (sum == (long)x) System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        // int t = 1;

        while (t-- > 0) {
            int n = in.nextInt();
            int x = in.nextInt();
            double[] arr = new double[n];
            for (int i = 0; i < n; ++i) {
                arr[i] = in.nextDouble();
            }
            double sum = 0;
            Arrays.sort(arr);
            for (int i = 0; i < n; ++i) {
                for (int j = i; j < n; ++j) {
                    sum = sum + ((arr[j])/(j+1));
                }
            }
            if ((int)sum == x) System.out.println("YES");
            else System.out.println("NO");
        }

        in.close();
    }
}

// 4 11
// 1 3 6 2
// 1 2 3 6
// 1/1 + 2/2 + 3/3 + 6/4 + 2/3 + 3/3 + 6/4 + 3/3 + 6/4 + 6/4
//
// 5 15
// 1 2 3 4 5
//
// -- Templates --
// System.out.println();
// System.out.print();
// for (int i = 0; i < n; ++i)
// Map<> map = new HashMap<>();


import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        // int t = 1;

        while (t-- > 0) {
            int n = in.nextInt();
            int x = in.nextInt();
            int sum = 0;
            for (int i = 0; i < n; ++i) {
                sum += in.nextInt();
            }

            if (sum == x) System.out.println("YES");
            else System.out.println("NO");
        }

        in.close();
    }
}

// -- Templates --
// System.out.println();
// System.out.print();
// for (int i = 0; i < n; ++i)
// Map<> map = new HashMap<>();


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.List;
import java.util.Collections;
public class C {
 	private static FastScanner fs=new FastScanner();
	public static void main(String[] args) {

		int t=fs.nextInt();
		while(t-->0)
		{
			int n = fs.nextInt();
			int m = fs.nextInt();
			long sum =0;
			for(int i=0;i<n;i++) sum +=fs.nextInt();
			if(sum==m) System.out.println("YES");
			else System.out.println("NO");
		}

	}

	static final Random random=new Random();

	static void ruffleSort(long[] a) {
		int n=a.length;//shuffle, then sort
		for (int i=0; i<n; i++) {
			int oi=random.nextInt(n); long temp=a[oi];
			a[oi]=a[i]; a[i]=temp;
		}
		Arrays.sort(a);
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
		int [] sort(int [] arr)
		{
			List<Integer> list = new ArrayList<>();
			for(int i : arr) list.add(i);

			Collections.sort(list);
			int res[] = new int[arr.length];
			for(int i=0;i<arr.length;i++) res[i] = list.get(i);

			return res;
		}
	}

}


import java.util.*;
public class reorder {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t=0;
        if(sc.hasNext())
        t = sc.nextInt();
        while(t--!=0){
            int n = sc.nextInt();
            int m = sc.nextInt();
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextDouble();
            }
            Arrays.sort(a);
            double s=0.0;
            for(int i=0; i<n; i++){
                for (int j = i; j <n; j++) {
                    s+=(a[j]/(j+1));
                    // System.out.println(s);
                }
            }
            if(s==m)System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


import java.util.*;
public class reorder {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t=0;
        if(sc.hasNext())
        t = sc.nextInt();
        while(t--!=0){
            int n = sc.nextInt();
            int m = sc.nextInt();
            int a;
            int s=0;
            for(int i=1; i<=n; i++){
                a = sc.nextInt();
                s+=a;
            }
            if(s==m)System.out.println("YES");
            else System.out.println("NO");
        }
    }
}


    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.StringTokenizer;

    public class Main {
        static class MyScanner {
            BufferedReader br;
            StringTokenizer st;

            public MyScanner() {
                br = new BufferedReader(new InputStreamReader(System.in));
            }

            String next() {
                while (st == null || !st.hasMoreElements()) {
                    try {
                        st = new StringTokenizer(br.readLine());
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
                return st.nextToken();
            }

            int nextInt() {
                return Integer.parseInt(next());
            }

            long nextLong() {
                return Long.parseLong(next());
            }

            double nextDouble() {
                return Double.parseDouble(next());
            }

            String nextLine(){
                String str = "";
                try {
                    str = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                return str;
            }

        }

        public static void main(String[] args) {
                MyScanner sc = new MyScanner();
                int t = sc.nextInt();
                while (t-- !=0){
                    int n = sc.nextInt();
                    int k = sc.nextInt();
                    int sum = 0;
                    for(int i =0; i< n;i++){
                        sum += sc.nextInt();
                    }
                    if(sum == k) System.out.println("YES");
                    else System.out.println("NO");

                }
        }
    }


import java.util.*;
public class Main {
    public static void main(String args[]) {
      int n,i,t,j,m;
      Scanner sc=new Scanner(System.in);
      t=sc.nextInt();
      while(t!=0)
      {
          n=sc.nextInt();
          m=sc.nextInt();int s=0;
          int a[]=new int[n];
          for(i=0;i<n;i++)
          {
              a[i]=sc.nextInt();
              s=s+a[i];
          }
          if(s==m)
          System.out.println("Yes");
          else
          System.out.println("No");
          t--;
      }
    }
}


import java.io.*;
import java.util.*;

public class S1389B {
public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int k=sc.nextInt();

			int[] ar=new int[n];

			for(int i=0;i<n;i++){
			    ar[i]=sc.nextInt();
			}
				Arrays.sort(ar);
			int sum=0; int m=0; int c=0;

			for(int i=0;i<n;i++){
			    for(int j=i;j<n;j++){
			         sum+=ar[j];
			         m+=j+1;
			         c++;
			    }
			}

			if(c*sum/m==k){
			    System.out.println("YES");
			}
			else if(c*sum/m!=k){
			    System.out.println("NO");
			}

		}
	}
}


import java.io.*;
import java.util.*;

public class S1389B {
public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int k=sc.nextInt();

			double[] ar=new double[n];

			for(int i=0;i<n;i++){
			    ar[i]=sc.nextDouble();
			}
				Arrays.sort(ar);
			double sum=0; int m=0; int c=0;

			for(int i=0;i<n;i++){
			    for(int j=i;j<n;j++){
			         sum+=ar[j]/(j+1);

			    }
			}

			if(sum==k){
			    System.out.println("YES");
			}
			else {
			    System.out.println("NO");
			}

		}
	}
}


import java.io.*;
import java.util.*;

public class S678{
public static void main(String[] args){
    Scanner sc=new Scanner(System.in);

		int t = sc.nextInt();
		while (t-- > 0) {
			int n = sc.nextInt();
			int k=sc.nextInt();

			double[] ar=new double[n];

			for(int i=0;i<n;i++){
			    ar[i]=sc.nextDouble();
			}
				//Arrays.sort(ar);
			double sum=0; int m=0; int c=0;

			for(int i=0;i<n;i++){
			    for(int j=i;j<n;j++){
			         sum+=ar[j]/(j+1);

			    }
			}
	//System.out.println(Math.round(sum));
			if(Math.round(sum)==k){
			    System.out.println("YES");
			}
			else {
			    System.out.println("NO");
			}

		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AReorder solver = new AReorder();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class AReorder {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            long sum = 0;
            for (int i = 0; i < n; i++) {
                sum += in.nextInt();
            }
            if (sum == m) {
                out.println("YES");
            } else {
                out.println("NO");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.*;

public class A {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        int testCases = sc.nextInt();

        for (int t = 0; t < testCases; t++) {
            int n = sc.nextInt();
            int m = sc.nextInt();

            long sum = 0;

            for (int i = 0; i < n; i++) {
                sum = sum + sc.nextInt();
            }

            if (sum == m) {
                sb.append("YES").append("\n");
                continue;
            }
            sb.append("NO").append("\n");

        }

        System.out.print(sb);
    }
}


import java.io.PrintWriter;
import java.util.Scanner;

public class A {

  public static PrintWriter out = new PrintWriter(System.out);
  public static Scanner in = new Scanner(System.in);

  public static void main(String[] args) {
    int t = ni();
    while (t-- > 0) solve();
    out.flush();
  }

  private static void solve() {
    int n = ni();
    int m = ni();
    int[] a = na(n);
    int sum = 0;
    for (int x : a) sum += x;
    if (sum == m) System.out.println("YES");
    else System.out.println("NO");
  }

  private static int ni() {
    return in.nextInt();
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = ni();
    return a;
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++) a[i] = nl();
    return a;
  }

  private static long nl() {
    return in.nextLong();
  }

  private float nf() {
    return in.nextFloat();
  }

  private static double nd() {
    return in.nextDouble();
  }
}


import java.util.*;
public class solution {
	public static void main (String[] args) {
		//code
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
		   int n=sc.nextInt();
		   int m=sc.nextInt();
		   int[] a=new int[n+1];
		   int sum=0;
		   for(int i=1;i<=n;i++)
		   {
		       a[i]=sc.nextInt();
		       sum+=a[i];
		   }
		   if(sum==m)
		   {
		       System.out.println("YES");
		   }
		   else
		   {
		       System.out.println("NO");
		   }
		}
	}
}


import java.io.*;
import java.util.*;
import java.util.StringTokenizer;

public class Main {
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(String[] args) {
        FastReader fs = new FastReader();
        int t = fs.nextInt();

        while(t-->0){
            int n = fs.nextInt();
            int m = fs.nextInt();
            int s =0;

            for(int i=0;i<n;i++){
                s += fs.nextInt();
            }

            if(s == m){
                System.out.println("YES");
            }else{
                System.out.println("NO");
            }
        }
    }

}


import java.util.*;

public class Reorder {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int test;
        test = in.nextInt();
        for (int c = 1; c <= test; c++) {
            int n, i, m, sum = 0;
            n = in.nextInt();
            m = in.nextInt();
            int[] num;
            num = new int[n];
            for (i = 0; i < n; i++) {
                num[i] = in.nextInt();
                sum = sum + num[i];
            }
            if (sum == m) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }
    }
}


#include<bits/stdc++.h>

int main(){
    int n;
    std::cin >> n;
    std::string word, new_word;
    int i,k;
    std::vector<std::string> words = std::vector<std::string>(n);
    for (i=0;i<n;i++){
        std::cin >> word;
        k = word.size();
        if (k > 10){
            new_word = word[0] + std::to_string(k-2) + word[k-1];
        }else{
            new_word = word;
        }
        words[i] = new_word;
    }
    for (i=0;i<n;i++){
        std::cout << words[i] << std::endl;
    }
    return 0;
}
// 1537477365878


#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n;
    cin >> n;
    string j;
    j= "";
    for (int a=1;a<=n; a++) {
        int f;
        string i;
        cin >> i;
        f=i.length();
        if (f>n) {
            j= j + i[0] + std::to_string(f-2) + i[f-1] + "\n";
        } else {
            j= j+ i + "\n";
        }

    }
    cout << j;
}

// 1502168137227


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	vector<string> v;
	cin >> n;
	string k[n];
	for(int i=0; i<n;i++){
		cin >> k[i];
	}
	for(int i=0; i<n; i++){
		if(k[i].length()<=10){
			cout << k[i] << '\n';
		}
		else{
			cout << k[i][0] << (k[i].length()-2) << k[i][k[i].length()-1] << '\n';
		}
	}
}
// 1521237459095


#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	string word;
	int l;
	while(n>0){
		cin>>word;
		int l=word.length();
		if(l>10){
			cout<<word[0]<<l-2<<word[l-1];
		}
		else cout<<word;
	}
	return 0;
}
// 1536989760722


#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	string s;
	for(int i = 0; i < n; i++){
	    cin>>s;
	    if(s.length() > 10){
	        cout << s[0] << s.length() - 2<< s[s.length() - 1] << endl;
	    }
	    else{
	        cout << s << endl;
	    }
	}
}

// 1502423431822


#include <bits/stdc++.h>
using namespace std;

int main(){
string q;
int n;
cin >> n;
string ins[n];
for (int i = 0; i < n; i++){
cin >> ins[i];
}
for (int i = 0; i < n; i++){
q = ins[i];
int l = q.size();
if (l > 10){
cout << q[0] << l - 2 << q[l - 1] << endl;
}
else{
cout << q << endl;
}
}
return 0;
}
// 1537232298047


#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	string word;
	while(n--){
		cin>>word;
		if(word.length()>10) cout<<word[0]<<word.length()-2<<word[word.length()-1];
		else cout<<word;
	}
	return 0;
}
// 1536990607616


#include<bits/stdc++.h>
using namespace std;

int main(){
	int nLines;
	cin>>nLines;

	while(nLines--){
		string word;
		cin>>word;
		if(word.size() > 10){
			cout<<word[0]<<word.size()-2<<word[word.size()-1]<<endl;
		}
		else cout<<word<<endl;
	}
	return 0;
}
// 1536953324403


#include <iostream> //para imprimir en pantalla
#include <vector>
using namespace std; //para no escribir std:: todo el rato

int main() {
	int n; //numero de lineas que tendra el input
  	cin>>n; //recibo variable
  	vector<string> lista(n); //crea vector que guarda strings (tipo lista)
  	for (int i = 0; i < n; i++)
  	{
  		string a;
  		cin>>a;
  		lista[i]=a;
  	}
  	for (int i = 0; i < n; i++)
  	{
  		if (lista[i].size()>10) //si el string tiene mas de 10 caracteres
  		{
  			cout<<lista[i][0]<<lista[i].size()-2<<lista[i][lista.size()-1]<<endl;
  		}
  		else {
  			cout<<lista[i]<<endl;
  		}
  	}
  	return 0;
}

// 1502672611887


#include <iostream>
#include <string>
#include <sstream>

int main() {
    int n_words;
    std::stringstream ss;
    std::string word, short_word;
    std::cin >> n_words;
    for (int i = 0; i < n_words; ++i) {
        std::cin >> word;
        int n = word.size();
        if(n <= 10)
            ss << word << std::endl;
        else {
            ss << word[0] << n - 2 << word[n - 1] << std::endl;
        }
    }
    std::cout << ss.str();
    return 0;
}
// 1537192296550


#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	string word;
	while(n>0){
		cin>>word;
		if(word.length()>10){cout<<word[0]<<word.length()-2<<word[word.length()-1]<<end1;
		}
		else {cout<<word<<end1;}
		n--;
	}
	return 0;
}
// 1536990424820


#include <iostream>
using namespace std;

int main()
{
  int k;
  cin >> k;
  for (int i = 0 ; i<k; i++) {
    string word;
    cin	>> word;
    if (word.size() > 10)
      {
        cout << word[0]<<word.size()-2<<word[word.size()-1]<<"\n";
      }
    else
      {
        cout << word  << "\n";
      }
  }
}

// 1502082738016


#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin >> n;

	while (n--){
		string palabra;
		cin >> palabra;
		if( palabra.length()>=10) {
			char k=palabra[0];
			char f=palabra[palabra.length()-1];
			cout<< k<<palabra.length()-2<<f<<"\n";
		}
		else {
			count<<palabra<<"\n";

			 }

	}

	return 0;
}
// 1521232394304


#include <iostream>
using namespace std;

int main(){
	int n;
	cin >> n;
	for(int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		int l = s.size();
		if(l > 10){
			string a = s[0]+to_string(l-2)+s[l-1];
			cout << a << endl;
		}
		else{
			cout << s << endl;
		}
	}
}
// 1501877253493


#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	string word;
	for(int i = 0; i < n; i++) {
		cin >> word;
		int len = word.length();
		if(len > 10)
			cout << word[0] << len - 2 << word[len - 1] << endl;
		else
			cout << word << endl;
	}
	return 0;
}
// 1536901303025


#include <iostream>

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n;
    while (n--)
    {
        cin >> s;
        if (s.length() > 10)
        {
            cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
        }
        else
        {
            cout << s << endl;
        }
    }
    return 0;
}
// 1522033031072


#include<bits/stdc++.h>
using namespace std;

int main(){
int n;
cin >> n;
string palabras[n];
for (int i=0;i<n;++i){
    cin >> palabras[i];
}
for (int i=0;i<n;++i){
    if (palabras[i].size()<=4)
        cout << palabras[i] << endl;
    else{
        cout << palabras[i][0] << palabras[i].size()-2 << palabras[i][palabras[i].size()-1]<<endl;
    }
}
return 0;}

// 1502645037403


#include <iostream>

using namespace std;

int main(){
    int n;
    cin >> n;
    string word;
    while(n--){
        cin>>word;
        if(word.length()>10)
            cout<<word[0]<<word.length()-2<<word[word.length()-1]<<endl;
        else
            cout<<word<<endl;
    }
    return 0;
}
// 1537015079423


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n;
    while (n--)
    {
        cin >> s;
        if (s.length() > 10)
        {
            cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
        }
        else
        {
            cout << s << endl;
        }
    }
    return 0;
}
// 1536366401975


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<string> entrada(n);

	for(int i=0; i <n; ++i){
		string palabra="";
		cin >> palabra;
		entrada[i]=palabra;

	}

	for(int i=0; i <entrada.size();++i){
		if(entrada[i].size() <=10){
			cout << entrada[i] << endl;
		} else{
			cout << entrada[i][0]+to_string(entrada[i].size()-2)+entrada[i][entrada[i].size()-1] << endl;
		}

	}
	return 0;

}
// 1537656796348


#include <iostream>
#include <string>
using namespace std;

int main() {

    int n;
    cin >> n;

    string words[n];
    int c = 0;

    while(n--){

        string p;
        cin >> p;
        words[c] = p;
        c++;
    }

    for(int i = 0; i < c; ++i){

        int tam = words[i].size();

        if(tam> 10){
            cout << words[i][0] << tam - 2 << words[i][tam-1]<< endl;

        }
        else{
            cout << words[i] << endl;
        }
    }
    return 0;
}

// 1521605915279


#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main(){
	int n;
	cin >> n;
	string first;
	cin>>first;
	string final;
	final = first + '\n';

	for (int i =2 ; i<=n; i = i+1){
		string input;
		cin >> input;
		int m;
		m= input.length() -2 ;
		string largo;          // string que queremos de resultado
		ostringstream convert;   // se usa variable stream para hacer la conversión
		convert << m;      // se inserta el número entero
		largo = convert.str();
		final = final + input.at(0) + largo + input.at(m-1) + '\n' ;

	}
	cout << final;
	return 0;

}
// 1502641396233


#include<bits/stdc++.h>

int main(){
    int n;
    std::cin >> n;
    std::string word, new_word;
    int i,k;
    std::vector<std::string> words = std::vector<std::string>(n);
    for (i=0;i<n;i++){
        std::getline(std::cin, word);
        k = word.size();
        if (k > 10){
            new_word = word[0] + std::to_string(k) + word[k-1];
        }else{
            new_word = word;
        }
        words[i] = new_word;
    }
    for (i=0;i<n;i++){
        std::cout << words[i] << std::endl;
    }
    return 0;
}
// 1537476965755


#include <bits/stdc++.h>

using namespace std;

int main(){

	int c;
	cin >> c;
	string s;
	int length;
	for (int i = 0; i < c; ++i)
	{
		cin >> s;
		length = s.length();
		cout << s[0] << length << s[length-1] << '\n';
	}

	return 0;
}
// 1536862762626


#include <cstdio>
#include <iostream>
using namespace std;

int main()
{
	int n;
	string s;
	cin>> n;
	for (int i=0; i<(n);i++){
		cin>>s;
			if (s.size()<=10)
				cout<< s<< endl;
			else
				cout<< s[0]<<(s.size()-2)<<s[(s.size()-1)]<< endl;

		}

	}
// 1521231753694


#include<bits/stdc++.h>
using namespace std;

int main() {
    int i;
    int n;
    cin >> n;
    vector<string> s(n);
    for(i=0;i<n;i++){
    cin>>s[i];
    if(s[i].size()>10){
        cout<<s[i][0]<<(s[i].size()-2)<<s[i][s[i].size()-1]<<"\n";
    }
    else {
        cout<<s[i]<<"\n";
    }
    }
    return 0;
}
// 1537023031817


#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	while (n--){
		char st[101];
		scanf(" %s",st);
		string str(st);
		if (str.size()<=10) cout << str << endl;
		else cout << str[0] << (str.size()-2) << str[str.size()-1]
				  << endl;
	}
	return 0;
}
// 1535812119659


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	string t;
	for (int i=0; i<n;++i){
		cin >> t;
		int a = t.size()-2;
		if (a+2>10) {
			t=t[0] + to_string(a) + t[a+1];
		}
		cout << t + "\n";

	}

	return 0;
}
// 1501877415299


#include <iostream>

using namespace std;

int main()
{
   int x;
   cin>>x;
   int i=0;
   for(i;i<x;i++){
    string t;
    cin>>t;
    int h=t.length();
    if(h>11){
        cout<<t[0]<<h-2<<t[h-1];
    }
    else{
        cout<<t;
    }
   }
}

// 1502207455791


#include <bits/stdc++.h>

using namespace std;

typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;

int main() {
    ll n; string w;
    cin >> n;
    for (ll i = 0; i < n; i++)
    {
        cin >> w;
        if (w.size() > 10) {
            cout << w[0] << w.size() - 2 << w[w.size() - 1] << "\n";
        } else {
            cout << w << "\n";
        }
    }
    return 0;
}
// 1537484406245


#include <bits/stdc++.h>
using namespace std;

int main(){
	int a;
	string b;
	cin>>a;
	for(int i=0; i<a;i++){
		cin>>b;
		if(b.size()>10){
			cout<<b[0]<<b.size()-2<<b[b.size()-1]<<'\n';
		}
		else{
			cout<<b<<'\n';
		}
	}
	return 0;
}
// 1536952205154


#include <bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	string word;
	for(int i = 0; i < n; i++) {
		cin >> word;
		int len = word.length();
		if(len > 10)
			cout << word[0] << len - 2 << word[len-1] << endl
		else
			cout << word << endl;
	}
	return 0;
}
// 1536901113847


#include <iostream> //para imprimir en pantalla
#include <vector>
using namespace std; //para no escribir std:: todo el rato

int main() {
	int n; //numero de lineas que tendra el input
  	cin>>n; //recibo variable
  	vector<string> lista(n); //crea vector que guarda strings (tipo lista)
  	cout<<endl;
  	for (int i = 0; i < n; i++)
  	{
  		string a;
  		cin>>a;
  		lista[i]=a;
  	}
  	cout<<endl;
  	for (int i = 0; i < n; i++)
  	{
  		if (lista[i].size()>10) //si el string tiene mas de 10 caracteres
  		{
  			cout<<lista[i][0]<<lista[i].size()-2<<lista[i][lista.size()-1]<<endl;
  		}
  		else {
  			cout<<lista[i]<<endl;
  		}
  	}
  	return 0;
}

// 1502672728884


#include <bits/stdc++.h>

using namespace std;

int main()
{
	int t;
	string word;

	cin >> t;
	while( t-- ){
		cin >> word;
		if( word.size() <= 10 )
			cout << word << endl;
		else{
			cout << word[0] << word.size()-2 << word[word.size()-1] << endl;
		}
	}

	return 0;
}
// 1508030181325


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	for (int k=0;k<n;k++){
		string s;
		cin>>s;
		int l=s.size();
		if(l>10){
			cout<<s[0]<<l-2<<s[l-1]<<'\n';
		}
		else{
			cout<<s<<'\n';
		}
	}
}
// 1511725575805


#include <bits/stdc++.h>

using namespace std;

int main() {
	vector<string> words;
	int n;
	cin >> n;
	string w;
	for (int i = 0; i < n; ++i) {
		cin >> w;
		words.push_back(w);
	}
	for (int i = 0; i < n; ++i) {
		string &word = words[i];
		if (word.size() > 10) {
			ostringstream os;
			os << word[0] << word.size() - 2 << *(word.cend() - 1);
			words[i] = os.str();
		}
	}
	for (const string &word : words) {
		cout << word << "\n";
	}
	return 0;
}

// 1536954358044


#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b; a < c; a++)
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;

int main() {
    string a, b;
    cin >> a >> b;
    reverse(b.begin(), b.end());
    if (a == b) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}
// 1481763888598


#include <iostream>
#include <string>
using namespace std;

int main ()
{
  int i;
  cin >> i;
  int j = 0;
  while (j<i){
    std::string Something = "";
    cin >> Something;
    if (Something.size()<= 10){
      cout << Something << "\n";
      j = j +1;}
    else{
      int z = Something.size();
      int x = z-2;
      char primera = Something.front();
      char ultima = Something.back();
      cout << primera << x << ultima << "\n";
      j = j + 1;}
  }
}
// 1505956324271


#include <bits/stdc++.h>
using namespace std;
int main (){
	int n;
	cin>>n;
	vector <string> vec(n);
	for(int i=0;i<n;i++){
		string p;
		cin>>p;
			if(p.size()>10){
				vec[i]=p[0]<<p.size()-2<<p[p.size()-1];
			}
			else {
				vec[i]=p;
			}
	}

	 for (int i=0;i<n;i++){
 		cout<<vec[i]<<endl;
		 }
	return 0;
}

// 1502573227602


#include <iostream>
#include <string.h>

using namespace std;

int main() {
    int n;
    char *s;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> s;
        if (strlen(s) > 10) {
            cout << s[0] << strlen(s) - 2 << s[strlen(s) - 1] << endl;
        }
        else {
            cout << s << endl;
        }
    }
    return 0;
}
// 1536939824784


#include <iostream>
#include <string> //incluye librería con strings

using namespace std;

int main(){
   //primero recibimos N líneas que vienen
   //procesamos las N líneas
   //para cada línea:
   //cuento el largo de la palabra
   //si es estrictamente mayor que 10, la acortamos
   //si no, no la acortamos y la entregamos tal cual
   //
   int n=0;
   cin >> n >> ws; //para entrada
   for (int i=0; i < n; i++){
       string current;
       getline(cin, current); //recibe la variable del cin, y la mete al current (temporal tmp) //OJO QUE TOMA TOO LO QUE ESTÁ ANTES DE UN SALTO DE LÍNEA
       if (current.size() > 10){ //acortar
          //salida //<< concatena
          cout << current[0] << current.size()-2 << current[current.size()-1] << endl; } //current[current.size()-1] toma el //////último  caracter
       else{
       cout << current << endl;
            }
                            }
return 0;

}
// 1536953120038


#include <iostream>
#include <cstring>
#include <string>

using namespace std;

void abbreviation() {
	int number;
	cin >> number;
	string words[number];

	for (int i = 0; i < number; ++i) {
		cin >> words[i];
	}

	for (int i = 0; i < number; ++i) {
		int len = words[i].size();
		if ((len) >= 10) {
			string abb = "";
			char first = words[i].at(0);
			abb += first;
			abb += to_string(len - 2);
			char last = words[i].at(len - 1);
			abb += last;
			cout << abb << endl;
		}

		else {
			cout << words[i] << endl;
		}
	}
}

int main() {
	abbreviation();
	return 0;
}
// 1537135472381


#include<bits/stdc++.h>

int main(){
    int n;
    std::cin >> n;
    std::string word, new_word;
    int i,k;
    std::vector<std::string> words = std::vector<std::string>(n);
    for (i=0;i<n;i++){
        std::cin >> word;
        k = word.size();
        if (k > 10){
            new_word = word[0] + std::to_string(k) + word[k-1];
        }else{
            new_word = word;
        }
        words[i] = new_word;
    }
    for (i=0;i<n;i++){
        std::cout << words[i] << std::endl;
    }
    return 0;
}
// 1537476299870


#include <iostream>
#include <string>
using namespace std;

int main() {
	int n, i;
	string s;
	cin >> n;
	for (i=0; i<n; i++) {
		cin >> s;
		if (s.length() > 10)
			cout << s[0] << s.length()-2 << s[-1] << endl;
		else
			cout << s << endl;
	}
	return 0;
}
// 1537659500878


#include <bits/stdc++.h>

using namespace std;

int main(){

    int n;
    string s;
    cin >> n;
    while (n--)
    {
        cin >> s;
        if (s.length() > 10)
        {
            cout << s[0] << s.length() - 2 << s[s.length() - 1] << endl;
        }
        else
        {
            cout << s << endl;
        }
    }
	return 0;
}

// 1521993950666


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	string w;
	for( int i=0 ; i<n ; i++){
		cin>>w;
		int largo = w.length();
		if (largo>10){
			cout<<w[0]<<largo-2<<w[largo-1]<<"\n";
		}
		else{
			cout<<w<<"\n";
		}
	}
}
// 1521781229640


int main() {
    int n;
    string word;

    cin>>n; //numero de palabras
    if(n>=1 && n<=100){
        for (int i=n;i>0;i=i-1){
            cin>>word; //palabra
            if (word.length()>10) {
                cout<<word[0]<<(word.length()-2)<<word[(word.length()-1)]<<endl;
                }
            else{
            cout<<word<<endl;
                }
            }
        }
    else {
        return 0;
        }
    return 0;
    }

// 1502512527244


#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	string word;
	while(n>0){
		cin>>word;
		if(word.length()>10){
			cout<<word[0]<<word.length()-2<<word[word.length()];
		}
		else cout<<word;
	}
	return 0;
}
// 1536989582791


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	for(int i = 1; i<=n ;i++){
		char texto[100];
		scanf("%s", texto);
		int largo = strlen(texto);
		if(largo >10){
			printf("%c", texto[0]);
			printf("%d", largo-2);
			printf("%c\n", texto[largo-1]);
		}else{
			printf("%s\n", texto|);
		}
	}
	cout << '\n';
	return 0;

}
// 1536951785840


#include <bits/stdc++.h>
#define fr(a, b, c) for(int a = b; a < c; ++a)
#define pb push_back

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
  int N;
  cin >> N;
  while (N--) {
    string str, ans;
    cin >> str;
    if (str.size() <= 10) ans = str;
    else {
      ans.pb(str[0]);
      ans.append(to_string(str.size() - 2));
      ans.pb(str[str.size()-1]);
    }
    cout << ans << endl;
  }
  return 0;
}

// 1497145189373


#include <iostream>
#include <string>
using namespace std;
int main(){
    string str;
    cin >> str;

    if(str.length() > 10){
        cout << str[0] << str.length()-2 << str[str.length()-1] << endl;
        }
    else{
        cout << str << endl;
        }
    return 0;
}

// 1502323644324


#include<iostream>
#include <bits/stdc++.h>
using namespace std;

// Directorio: cd C:\Users\juanj\Desktop\Codigo\C++
// Compila y crea EXE: g++ -std=c++11 nombreCodigo.cpp -o NombreEXE
// Si no pongo nombre al EXE se llamara "a"

string tooLong(string s){
	if (s.size() > 10){
		string word;
		word = s[0] + to_string(s.size() - 2) + s[s.size() - 1];
		return word;
	}
	else{
		return s;
	}
}

int main() {
	int n;
	cin >> n;

	vector<string> vec(n);
	for (int i = 0; i < n; i++){
		string a;
		cin >> a ;
		vec[i] = a;
	}
	string shortWord;
	for (int i = 0; i < n; i++){

		shortWord = tooLong(vec[i]);
		cout << shortWord << '\n';
	}

    return 0;
}
// 1536878208404


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin>>n;
	vector <string> words(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>words[i];
	}
	for (int i = 0; i < n; ++i)
	{
		if( words[i].size() > 10 )
			cout<<words[i][0]<<words[i].size()-2<<words[i][words[i].size()-1]<<endl;
		else
			cout<<words[i]<<endl;
	}
	return 0;
}
// 1521838518096


#include <iostream>
using namespace std;

int main() {
    int inputs;
    cin >> inputs;
    string strings[inputs];

    for (int i = 0; i < inputs; ++i) {
    	cin >> strings[i];
    }

    cout << "tus strings son:\n";
    for (int j = 0; j < inputs; ++j) {
    	string actual = strings[j];
    	if (actual.length() > 10)
    		cout << actual.front() << to_string(actual.length()-2) << actual.back() << "\n";
    	else
    		cout << actual << "\n";
    }

    return 0;
}

// 1537045559825


#include <iostream>
#include <strings.h>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int main(){

	string str;
	int ct;
	cin>>ct;

	while(ct--){
		cin>>str;
		if(str.size()<=10)cout<<str<<endl;
		else{
			cout<<str[0]<<str.size()-2<<str[str.size()-1]<<endl;
		}
	}

	return 0;
}
// 1541252882056


#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n;
    cin >> n;
    vector<string> lista(n);
    for (int i=0;i<n;i++){
            string a;
            cin>>a;
            lista[i]=a;
            }

  	for (int i=0; i<n;i++) {
        if (lista[i].size()>10){
            cout << lista[i][0]<<lista[i].size()-2<<lista[i][lista[i].size()-1]<<endl;
            }
        else {
            cout << lista[i]<<endl;
            }
        }

    return 0;
}
// 1502673328398


#include <bits/stdc++.h>
using namespace std;

 int main(){
 	int n;
 	cin>>n;
 	for(int i=1; i<=n; i++){
 		string palabra;
 		cin>> palabra;
 		if(palabra.length()>10){
 			cout<<palabra[0] << palabra.length()-2 << palabra[palabra.length()-1] << endl;

 		}
 		else{
 			cout << palabra << endl;
 		}

 	}
 	return 0;
 }
// 1521226296138


#include <iostream>
#include <string>
using namespace std;

int main () {

   // for loop execution
    string input = "";
    int n_p;
    cin >> n_p;
    string *list_words;                //Declare pointer to type of array
    list_words = new string[n_p];   //use 'new' to create array of size x
    string word;

    // How to get a string/sentence with spaces
    for( int i = 0; i < n_p; i = i + 1 ) {
        cin >> input;
        list_words[i] = input;

    }
    for( int i = 0; i < n_p; i = i + 1 ) {
        if (list_words[i].length()>10){
            word = list_words[i];
            list_words[i]=word[0]+to_string(list_words[i].length()-2)+word.back();
        }

        //std::cout << list_words[i]<< ":" << list_words[i].length();
    }
    for( int i = 0; i < n_p; i = i + 1 ) {
        cout << list_words[i]<< endl;

    }

    return 0;
}

// 1502165881779


#include <bits/stdc++.h>
using namespace std;

string convert(string word){
	int l = word.length();
	if(l > 10){
		return word.substr(0,1) + to_string(l-2) + word.substr(l-1,1);
	}
	else{
		return word;
	}
}

int main(){
	int n;
	cin >> n;

	for (int i = 0; i < n; i++){
		string w;
		cin >> w;
		cout << convert(w) << '\n';
	}
}
// 1501879161786


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    string word;

    cin>>n; //numero de palabras
    for (i=n;i>0;i=i-1){
        cin>>word; //palabra
        if (word.length()>10) {
            cout<<word[0]<<(word.length()-2)<<word[(word.length()-1)]<<endl;
            }
        else{
            cout<<word<<endl;
            }
        }
return 0;
}

// 1502512115986


/*Way Too Long Words-Pablo Diamante*/
#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main(){

int nlineas, i;
string salida ="";
string input, abreviacion, primera, ultima, largostr;
ostringstream str1; //sera un intermediario para pasar int a string

//pedir primera linea
cin >> nlineas;

//segun el numero de lineas ir agregando el resultado al string salida
for (i=1; i<=nlineas; i++){
    //pedir i-esima palabra
    cin >> input;
    if (input.size()<10){
        salida.append(input+"\n");
    }
    else{
        //obtener primer y ultimo caracter del string
        primera = input[0];
        ultima = input[input.size()-1];

        //transformar el tamaño-2 a stream
        str1.str(""); //NECESARIO PARA RESETEAR ESTE OBJETO OSTRINGSTREAM
        str1 << input.size()-2;
        largostr=str1.str();

        //concatenar y agregar al output final
        abreviacion = primera+largostr+ultima;
        salida.append(abreviacion+"\n");
    }
}
//muestra el resultado
cout << salida << endl;
// salida.append(input+"\n"); esto funciona!
return 0;}
// 1502667415051


#include <iostream>

using namespace std;

int main(){
    int n;
    string mensagem;
    cin >> n;
    while(n--){
        cin >> mensagem;
        if(mensagem.size() > 10){
            cout << mensagem[0] << mensagem.size() - 2 << mensagem[mensagem.size() - 1] << endl;
        }
        else cout << mensagem << endl;
    }
    return 0;
}

// 1508032941688


#include<bits/stdc++.h>
#include <iostream>
#include<vector>
using namespace std;

int main() {
    int a;
    scanf("%d",&a);
    while(a--){
        char k[101];
        scanf("%s",k);
        string z(k);
        if(z.length()>10){
            int kk = z.length()-2;
            printf("%c%d%c\n",z[0],kk,z[z.length()-1]);
        }else{
            printf("%s\n",z.c_str());
        }
    }
    return 0;
}
// 1535852154049


#include<bits/stdc++.h>
using namespace std;

int main(){
    string s;
    long int i, n;
    cin >> n;
    getchar();
    for(i=0; i<n; i++){
        getline(cin, s);
        if(s.size() <= 10) cout << s << endl;
        else cout << s[0] << s.size()-2 << s[s.size()-1] << endl;
    }
}

// 1541252570982


#include<stdio.h>
#include<sstream>
#include<cstdlib>
#include<string>
#include<iostream>

using namespace std;

main()
{
    stringstream stream;
    string word, l_i, l_f, lg;
    int n, i = 0, siz, large;
    cin >> n;
    string arrange[n];
    while (i<n){
        cin >> word;
        siz = word.size();
        if (siz>10){
            l_i=word.substr(0,1);
            l_f=word.substr((siz-1),1);
            large=word.size()-2;
            stream << large;
            lg=stream.str();
            arrange[i]=l_i + lg + l_f;

        }else {
            arrange[i]=word;
        }
        stream.str("");
        i++;
    }
    for (int x=0;x<n;x++){
            cout<<arrange[x]<<endl;
    }

return 0;}

// 1502642052488


#include <bits/stdc++.h>
using namespace std;

int main (){

	int n;
	vector<string> s;

	cin >> n;

	for(int i=0; i<n ; i++){
		string str;
		cin >> str;

		if(str.size()>10){
			string s =  str.substr(0, 1) + to_string(str.size() - 2) + str.substr(str.size()-1, 1);

			str = s;
		}

		s.push_back(str);
	}

	for(int i=0; i<n ; i++){
		cout << s[i] << "\n";
	}
	return 0;
}
// 1521402604862


#include <iostream>

int main(){

    int num;
    std::cin>>num;
    num++;
    std::string entrada[num];

    for(int i=0;i<num;i++){
        getline(std::cin, entrada[i]);
    }

    for(int i=0;i<num;i++){
        for(int j=0;j<100;j++){
            if(entrada[i][j]=='\0'){
                if(j<=10){
                    std::cout<<entrada[i]<< std::endl;
                }else {
                    j=j-2;
                    std::cout<<entrada[i][0]<<j<<entrada[i][j+1]<<std::endl;
                }
                j=100;
            }
        }
    }
}
// 1536870689311


#include<bits/stdc++.h>

using namespace std;

int main(){
    int n_palabs;
    string strCnsl;
    int contHI = 0;
    int contLO = 0;
    cin >> n_palabs;
    for(int i=1;i<=n_palabs; ++i){
        cin >> strCnsl;
        if(strCnsl.length() > 10){
            cout << strCnsl[0] << strCnsl.length()-2 << strCnsl[strCnsl.length()-1] << endl;
        }
        else
            cout << strCnsl << endl;
    }
return 0;}

// 1521668319985


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
    	string s;
    	cin >> s;
    	int b=s.length();
    if (b>10){
    cout<<s[0] << (b-2) << s[s.length()-1] <<  "\n";
    }
    else { cout<< s << "\n";}

	}
}
// 1502647986767


#include <iostream>
#include <string>

using namespace std;

int main(){
    int times;
    cin >> times;
    string s1[times];

    int number[times];

    for(int i = 0; i < times; i++){
        cin >> s1[i];
    }

    for(int i = 0; i < times; i++){
        if(s1[i].length() > 10){
            number[i] = s1[i].length() - 2;
            s1[i][3] = s1[i][s1[i].length() - 1];
        }
        if(s1[i].length() <= 10){
            number[i] = 0;
        }
    }

    for(int i = 0; i < times; i++){
        if(number[i] != 0){
          cout << s1[i][0] << number[i] << s1[i][3] << endl;
        } else {
          cout << s1[i] << endl;
        }
    }

    return 0;
}
// 1535847095925


#include <bits/stdc++.h>
using namespace std;

int main(){
    int N; cin>>N;
    for(int i=0; i<N; i++){
        string a; cin >> a;
        int len = a.length();
        if(len>10){
            cout<<a[0]<<len-2<<a[len-1]<<endl;
        }
        else{
            cout << a << endl;
        }
    }
    return 0;
}
// 1537491563236


#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main() {
    int lim;
    cin >> lim;
    string arreglo[lim];
    string word;
    for(int k = 0; k < lim ; k++) {
        cin >> word;
        arreglo[k] = word;
    }
    for(int k = 0; k < lim; k++) {
        word = arreglo[k];
        if(word.length() > 10) {
            stringstream ss;
            ss << word[0] << word.length() -2 << word[word.length()-1d];
            cout << ss.str() << endl;
        } else {
            cout << word << endl;
        }
    }
}
// 1502395065751


#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    for(int i=0;i<n;i++){
        string s;cin>>s;
        if(s.size()<=10){cout<<s<<'\n';continue;}
        else{
            cout<<s[0]<<(s.size()-2)<<s[s.size()-1]<<'\n';
        }
    }
    return 0;
}
// 1502293036012


#include <iostream>
using namespace std;

int main()
{
  int k;
  cin >> k;
  string arr [k];
  int j = 0;
  while (j < k) {
    cin >> arr[j];
    j = j+1;
  }
  for (int i = 0 ; i<k; i++) {
    if (arr[i].size() > 10)
    {
      cout << arr[i][0]<<arr[i].size()-2<<arr[i][arr[i].size()-1]<<"\n";
    }
    else
    {
      cout << arr[i] << "\n";
    }
  }
}

// 1501878376548


#include <iostream>
#include <string>

using namespace std;

int main() {
	int number;
	cin >> number;
	string words;

	for (int i = 0; i < number; ++i) {
		cin >> words;
		int len = words.size();
		if ((len) > 10) {
			string abb = "";
			char first = words.at(0);
			abb += first;
			abb += to_string(len - 2);
			char last = words.at(len - 1);
			abb += last;
			cout << abb << endl;
		}

		else {
			cout << words << endl;
		}
	}
	return 0;
}
// 1537136674300


#include <cstdio>
#include <iostream>
using namespace std;

int main()
{
	int n;
	string s;
	cin>> n;
	for (int i=0; i<(n);i++){
		cin>>s;
			if (s.size()<=10)
				cout<< s<< endl;
			else
				cout<< s[0]<<(s.size()-2)<<s[(s.size()-1)]<< endl;

		}

	}
// 1521510713826


#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
	int N;
	string W;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> W;
		if (W.length() <= 10) {
			cout << W << "\n";
		}
		else {
			cout << W.front() << W.length() - 2 << W.back() << "\n";
		}
	}
}
// 1502165711701


#include <iostream>
using namespace std;
int main() {
    int n; long sz;
    cin >> n;
    string wtlw;
    for (int i = 0; i < n; i++) {
        cin >> wtlw;
        sz = wtlw.size();
        if(wtlw.size()>10){
            cout << wtlw[0] << sz-2 << wtlw[sz-1] << '\n';
        }
        else{
            cout << wtlw << '\n';
        }
    }
    return 0;
}
// 1502166379940


#include <iostream>
#include <string>
using namespace std;

int main ()
{
  int i;
  cout << "Please enter an integer value: \n";
  cin >> i;
  cout << "The value you entered is " << i << "\n";
  int j = 0;
  while (j<i){
    std::string Something = "";
    cin >> Something;
    if (Something.size()<= 10){
      cout << Something << "\n";
      j = j +1;}
    else{
      int z = Something.size();
      int x = z-2;
      char primera = Something.front();
      char ultima = Something.back();
      cout << primera << x << ultima << "\n";
      j = j + 1;}
  }
}
// 1505956200496


#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	string palabra;
	for(int i=1;i<=n;++i){
		cin >> palabra;
		if(palabra.size()<10){
			cout << palabra+"\n";
		}
		else{
			cout << palabra[0] << palabra.size()-2 << palabra[palabra.size()-1] << "\n";
		}
	}
	return 0;
}
// 1521225898243


#include <bits/stdc++.h>

using namespace std;

int main(){
  int cantidad_frases;
  cin >> cantidad_frases;
  for(int i=0;i<cantidad_frases;i++){
    string frase;
    cin >> frase;
    if(frase.size()>10){
      cout << frase.front() << frase.size()-2 << frase.back() << endl;
    }else{
      cout << frase << endl;
    }
  }
return 0;
}
// 1537393320846


#include <bits/stdc++.h>
using namespace std;
int main()
{
	int k;
	cin >> k;
	while(k--)
	{
		string s;
		cin >> s;
		if(s.size() <= 10) cout << s << endl;
		else
		{
			cout << s[0];
			cout << s.size()-2;
			cout << s[s.size()-1] << endl;
		}
	}
}
// 1541252807718


#include<bits/stdc++.h>
using namespace std;

int main() {

	int n;
	cin >> n;
	string word;

	for(int i = 0; i < n; i++) {
		cin >> word;

		if(word.length() > 10) {
			cout << word.at(0) << word.length() - 2 << word.at(word.length() - 1) << endl;
		} else {
			cout << word << endl;
		}
	}

	return 0;
}
// 1537471518072


#include <iostream>
#include <string>
using namespace std;

int main(){
    int a;
    cin >> a;
    for(int i = 0; i < a ; ++i){
        string word;
        cin >> word;
        cout << endl;
        int len = word.size();
        if(len>10){
            cout << word[0]<<(len-2)<<word[len-1]<< endl;
        }
        else{
            cout << word <<endl;
        }
    }
}
// 1536980792755


#include <bits/stdc++.h>
using namespace std;
int main(){
    string w;
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i) {
        cin >> w;
        int l = w.size();
        if (l > 10){
            cout << w[0]+to_string(l-2)+w[l-1] << '\n';
        }
        else {
            cout << w << '\n';
        }
    }
    return 0;
}

// 1502659978317


#include <bits/stdc++.h>

using namespace std;

int main() {
    int a;
    string b;
    int tamano;
    cin >> a;
    for(int i=0; i<a; i++){
        cin >> b;
        tamano=b.size();
        if(tamano<=10){
            cout << b << '\n';
        }
        else{
            cout << b[0] << tamano-2 << b[tamano-1] << '\n';
        }
    }
    return 0;
}
// 1502492388731


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    string s;
    cin >> n;
    while (n--)
    {
        cin >> s;
        if (s.length() > 10)
        {
            cout << s[0] << s.length() - 2 << s[s.length()] << endl;
        }
        else
        {
            cout << s << endl;
        }
    }
    return 0;
}
// 1536366304503


#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n;
    vector<string> w;
    cin>>n;
    for(int x = 0; x < n; x++){
        string l;
        cin>>l;
        w.push_back(l);
    }
    for (auto x : w){
        if(x.size() > 10) {
            cout << x.front() << x.size() - 2 << x.back() << endl;
        }else{
            cout<<x<<endl;
        }
    }
    return 0;
}
// 1535837282040


#include <iostream>
#include <string>
using namespace std;

int main() {
	int n, i;
	string s;
	cin >> n;
	for (i=0; i<n; i++) {
		cin >> s;
		if (s.length() > 10)
			cout << s[0] << s.length()-2 << s[s.length()-1] << endl;
		else
			cout << s << endl;
	}
	return 0;
}
// 1537663224768


#include <bits/stdc++.h>

using namespace std;

int main(){
	int N,i;
	vector<string> s;
	string aux;
	cin >> N;

	for(i = 0; i < N; i++ )
	{
		cin >> aux;
		s.push_back(aux);
	}

	for(auto words: s)
	{
		if(words.size() <= 10){
			cout << words << endl;
		}else {
			cout << words.front() << words.size() - 2 << words.back() << endl;
		}
	}

	return 0;

	}

// 1536340062493


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);

    //input's

    int n;
    cin >> n;
    vector <string> vec;

    int i;
    i=0;

    while (i<n) {
        string s;
        cin >> s;
        vec.push_back(s);
        i++;
    }

    //transformacion + output

    int j;
    j=0;

    cout << "\n";

    while (j<i) {

        string a;
        a=vec[j];
        if (a.size()>9) {
            cout << a[0] << a.size()-2 << a[a.size()-1] << "\n";
        } else {
            cout << a << "\n";
        }

        j++;
    }

    return 0;
}
// 1537307179416


#include <iostream> //para imprimir en pantalla
#include <vector>
using namespace std; //para no escribir std:: todo el rato

int main() {
	int n; //numero de lineas que tendra el input
  	cin >> n; //recibo variable
  	cout<<endl;
  	vector<string> lista(n); //crea vector que guarda strings (tipo lista)
  	for (int i= 0;i<n;i++){
  		string a;
  		cin>>a;
  		lista[i]=a;
  		}
	cout<<endl;

  	for (int i=0; i<n; i++){
  		if (lista[i].size()>10){
  			cout << lista[i][0]<<lista[i].size()-2<<lista[i][lista.size()-1]<<endl;
  			}
  		else {
  			cout<<lista[i]<<endl;
  		}
  	}

  	return 0;
}

// 1502672992064


#include <iostream>
#include <string> //incluye librería con strings

using namespace std;

int main(){
   //primero recibimos N líneas que vienen
   //procesamos las N líneas
   //para cada línea:
   //cuento el largo de la palabra
   //si es estrictamente mayor que 10, la acortamos
   //si no, no la acortamos y la entregamos tal cual
   //
   int n=0;
   cin >> n >> ws; //para entrada
   for (int i=0; i < n; i++){
       string current;
       getline(cin, current); //recibe la variable del cin, y la mete al current (temporal tmp) //OJO QUE TOMA TOO LO QUE ESTÁ ANTES DE UN SALTO DE LÍNEA
       if (current.size() > 10){ //acortar
          //salida //<< concatena
          cout << current[0] << current.size()-2 << current[current.size()-1] << endl; } //current[current.size()-1] toma el //////último  caracter
       else{
       cout << current << endl;
            }
                            }
return 0;

}

// 1536953252046


#include <iostream>
using namespace std;

int main ()
{
  int n; int i;
  string s;
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> s;
  	if(s.length() > 10){
      cout << s[0] + s.length()-2 + s[s.length()-1] << endl;
    }
    else{
      cout << s << endl;
    }
  }
  return 0;
}
// 1502391086593


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int loops = 0;
    scanf("%d", &loops);

    while(loops--)
    {
        int i = 0;
        char string_a[101] = {'\0'};
        scanf("%s", string_a);

        for(i = 0 ; string_a[i] != '\0' ; i++);

        if(i > 10)
            printf("%c%d%c\n", string_a[0], i-2 ,string_a[i-1]);
        else
            puts(string_a);
    }

    return 0;
}

// 1535993654800


#include <bits/stdc++.h>
using namespace std;

int main(){
	int n;
	cin >> n;
	for(int i = 1; i<=n ;i++){
		char texto[100];
		scanf("%s", texto);
		int largo = strlen(texto);
		if(largo >10){
			printf("%c", texto[0]);
			printf("%d", largo-2);
			printf("%c\n", texto[largo-1]);
		}else{
			printf("%s\n", texto|);
		}
	}
	cout << '\n';
	return 0;

}
// 1536951834540


#include <iostream>
using namespace std;

int main() {
    int inputs;
    cin >> inputs;
    string strings[inputs];

    for (int i = 0; i < inputs; ++i) {
    	cin >> strings[i];
    }

    cout << "tus strings son:\n";
    for (int j = 0; j < inputs; ++j) {
    	if (strings[j].length() > 10)
    		cout << strings[j].front() << to_string(strings[j].length()-2) << strings[j].back() << "\n";
    	else
    		cout << strings[j] << "\n";
    }

    return 0;
}

// 1537045353515


#pragma GCC optimize(2)
// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG

const int MOD=1e9+7;

int n,m;
vector<int> vec[300100],vec2[300100];
int visit[300100];
int par[300100];
int roat[300100],r;
pii edge[300100];

inline int find(int a)
{
	if(par[a]==a) return a;
	return par[a]=find(par[a]);
}

inline void dfs(int a,int p)
{
//	debug(a);
	visit[a]=1;
	roat[r++]=a;
//	for(int i=0;i<roat.size();i++) printf("%d ",roat[i]); puts("");
	for(register int i=0;i<vec[a].size();i++)
	{
		int u=vec[a][i];
		if(u==p) continue;
		if(!visit[u])
			dfs(u,a);
		else if(visit[u]==1)
		{
//			debug(a);debug(u);
			int ppp=find(u);
			for(int j=r-1;j>=0;j--)
			{
				if(roat[j]==u) break;
				if(ppp==find(roat[j])) continue;
				par[roat[j]]=u;
			}
		}
	}
	visit[a]=2;
	roat[--r]=0;
}

int res=0;
inline int dfs2(int a,int p)
{
	visit[a]=1;
	int mx=0,mx2=0;
	for(register int i=0;i<vec2[a].size();i++)
	{
		int u=vec2[a][i];
		if(u==p) continue;
		int t=dfs2(u,a);
		if(t>mx) mx2=mx,mx=t;
		else if(t>mx2) mx2=t;
	}
	res=max(res,mx+mx2);
	return mx+1;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	scanf("%d%d",&n,&m);
	for(register int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vec[--a].PB(--b);
		vec[b].PB(a);
		edge[i]=MP(a,b);
	}
	for(register int i=0;i<n;i++) par[i]=i;
	dfs(0,-1);
//	for(int i=0;i<n;i++) printf("par[%d]=%d\n",i,par[i]);
	for(register int i=0;i<m;i++)
	{
		int a=find(edge[i].fi);
		int b=find(edge[i].se);
		if(a!=b)
		{
			vec2[a].PB(b);
			vec2[b].PB(a);
		}
	}
	memset(visit,0,sizeof(visit));
	for(register int i=0;i<n;i++)
		if(!visit[i]&&par[i]==i)
			dfs2(i,-1);
	printf("%d\n",res);
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}
/*
9 10
1 2
2 3
3 4
1 5
5 7
7 9
7 8
8 9
5 6
2 4
*/


// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG

const int MOD=1e9+7;

int n,m;
vector<int> vec[300100],vec2[300100];
int visit[300100];
int par[300100];
vector<int> roat;
int col[300100],color;
pii edge[300100];

void dfs(int a,int p)
{
//	debug(a);
	visit[a]=1;
	par[a]=p;
	roat.PB(a);
//	for(int i=0;i<roat.size();i++) printf("%d ",roat[i]); puts("");
	col[a]=color++;
	for(int i=0;i<vec[a].size();i++)
	{
		int u=vec[a][i];
		if(u==p) continue;
		if(!visit[u])
			dfs(u,a);
		else
		{
			for(int j=roat.size()-1;j>=0&&roat[j]!=u;j--)
				col[roat[j]]=col[u];
		}
	}
	roat.erase(roat.end()-1);
}

int res=0;
int dfs2(int a,int p)
{
	int mx=0,mx2=0;
	for(int i=0;i<vec2[a].size();i++)
	{
		int u=vec2[a][i];
		if(u==p) continue;
		int t=dfs2(u,a);
		if(t>mx) mx2=mx,mx=t;
		else if(t>mx2) mx2=t;
	}
	res=max(res,mx+mx2);
	return mx+1;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vec[--a].PB(--b);
		vec[b].PB(a);
		edge[i]=MP(a,b);
	}
	memset(col,-1,sizeof(col));
	dfs(0,-1);
//	for(int i=0;i<n;i++) printf("col[%d]=%d\n",i,col[i]);
	for(int i=0;i<m;i++)
	{
		if(col[edge[i].fi]!=col[edge[i].se])
		{
			vec2[col[edge[i].fi]].PB(col[edge[i].se]);
			vec2[col[edge[i].se]].PB(col[edge[i].fi]);
		}
	}
	memset(visit,0,sizeof(visit));
	dfs2(0,-1);
	printf("%d\n",res);
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}
/*
8 8
1 4
4 3
3 7
7 6
6 5
5 3
3 2
1 2
*/


// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG

const int MOD=1e9+7;

int n,m;
vector<int> vec[300100],vec2[300100];
int visit[300100];
int par[300100];
vector<int> roat;
int col[300100],color;
pii edge[300100];

void dfs(int a,int p)
{
//	debug(a);
	visit[a]=1;
	par[a]=p;
	roat.PB(a);
//	for(int i=0;i<roat.size();i++) printf("%d ",roat[i]); puts("");
	col[a]=color++;
	for(int i=0;i<vec[a].size();i++)
	{
		int u=vec[a][i];
		if(u==p) continue;
		if(!visit[u])
			dfs(u,a);
		else
		{
			for(int j=roat.size()-1;j>=0&&roat[j]!=u;j--)
				col[roat[j]]=col[u];
		}
	}
	roat.erase(roat.end()-1);
}

int res=0;
int dfs2(int a,int p)
{
	visit[a]=1;
	int mx=0,mx2=0;
	for(int i=0;i<vec2[a].size();i++)
	{
		int u=vec2[a][i];
		if(u==p) continue;
		int t=dfs2(u,a);
		if(t>mx) mx2=mx,mx=t;
		else if(t>mx2) mx2=t;
	}
	res=max(res,mx+mx2);
	return mx+1;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vec[--a].PB(--b);
		vec[b].PB(a);
		edge[i]=MP(a,b);
	}
	memset(col,-1,sizeof(col));
	dfs(0,-1);
//	for(int i=0;i<n;i++) printf("col[%d]=%d\n",i,col[i]);
	for(int i=0;i<m;i++)
	{
		if(col[edge[i].fi]!=col[edge[i].se])
		{
			vec2[col[edge[i].fi]].PB(col[edge[i].se]);
			vec2[col[edge[i].se]].PB(col[edge[i].fi]);
		}
	}
	memset(visit,0,sizeof(visit));
	for(int i=0;i<n;i++)
		if(!visit[i])
			dfs2(i,-1);
	printf("%d\n",res);
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}
/*
6 7
1 2
2 3
3 5
5 4
4 3
1 3
5 6
*/


// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG

const int MOD=1e9+7;

int n,m;
vector<int> vec[300100],vec2[300100];
int visit[300100];
int par[300100];
vector<int> roat;
int col[300100],color;
pii edge[300100];

void dfs(int a,int p)
{
//	debug(a);
	visit[a]=1;
	par[a]=p;
	roat.PB(a);
	for(int i=0;i<roat.size();i++) printf("%d ",roat[i]); puts("");
	col[a]=color++;
	for(int i=0;i<vec[a].size();i++)
	{
		int u=vec[a][i];
		if(u==p) continue;
		if(!visit[u])
			dfs(u,a);
		else
		{
			for(int j=roat.size()-1;j>=0&&roat[j]!=u;j--)
				col[roat[j]]=col[u];
		}
	}
	roat.erase(roat.end()-1);
}

int res=0;
int dfs2(int a,int p)
{
	int mx=0,mx2=0;
	for(int i=0;i<vec2[a].size();i++)
	{
		int u=vec2[a][i];
		if(u==p) continue;
		int t=dfs2(u,a);
		if(t>mx) mx2=mx,mx=t;
		else if(t>mx2) mx2=t;
	}
	res=max(res,mx+mx2);
	return mx+1;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vec[--a].PB(--b);
		vec[b].PB(a);
		edge[i]=MP(a,b);
	}
	memset(col,-1,sizeof(col));
	dfs(0,-1);
//	for(int i=0;i<n;i++) printf("col[%d]=%d\n",i,col[i]);
	for(int i=0;i<m;i++)
	{
		if(col[edge[i].fi]!=col[edge[i].se])
		{
			vec2[col[edge[i].fi]].PB(col[edge[i].se]);
			vec2[col[edge[i].se]].PB(col[edge[i].fi]);
		}
	}
	memset(visit,0,sizeof(visit));
	dfs2(0,-1);
	printf("%d\n",res);
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}
/*
8 8
1 4
4 3
3 7
7 6
6 5
5 3
3 2
1 2
*/


// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG

const int MOD=1e9+7;

int n,m;
vector<int> vec[300100],vec2[300100];
int visit[300100];
int par[300100];
vector<int> roat;
pii edge[300100];

int find(int a)
{
	if(par[a]==a) return a;
	return par[a]=find(par[a]);
}

void dfs(int a,int p)
{
//	debug(a);
	visit[a]=1;
	roat.PB(a);
//	for(int i=0;i<roat.size();i++) printf("%d ",roat[i]); puts("");
	for(int i=0;i<vec[a].size();i++)
	{
		int u=vec[a][i];
		if(u==p) continue;
		if(!visit[u])
			dfs(u,a);
		else if(visit[u]==1)
		{
//			debug(a);debug(u);
			for(int j=roat.size()-1;j>=0;j--)
			{
				if(roat[j]==u) break;
				if(find(u)==find(roat[j])) continue;
				par[roat[j]]=u;
			}
		}
	}
	visit[a]=2;
	roat.erase(roat.end()-1);
}

int res=0;
int dfs2(int a,int p)
{
	visit[a]=1;
	int mx=0,mx2=0;
	for(int i=0;i<vec2[a].size();i++)
	{
		int u=vec2[a][i];
		if(u==p) continue;
		int t=dfs2(u,a);
		if(t>mx) mx2=mx,mx=t;
		else if(t>mx2) mx2=t;
	}
	res=max(res,mx+mx2);
	return mx+1;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vec[--a].PB(--b);
		vec[b].PB(a);
		edge[i]=MP(a,b);
	}
	for(int i=0;i<n;i++) par[i]=i;
	dfs(0,-1);
//	for(int i=0;i<n;i++) printf("par[%d]=%d\n",i,par[i]);
	for(int i=0;i<m;i++)
	{
		int a=find(edge[i].fi);
		int b=find(edge[i].se);
		if(a!=b)
		{
			vec2[a].PB(b);
			vec2[b].PB(a);
		}
	}
	memset(visit,0,sizeof(visit));
	for(int i=0;i<n;i++)
		if(!visit[find(i)])
			dfs2(find(i),-1);
	printf("%d\n",res);
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}
/*
9 10
1 2
2 3
3 4
1 5
5 7
7 9
7 8
8 9
5 6
2 4
*/


// author: lkx
// Problem:
// ID:
#include<bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define MP make_pair
#define PH push
#define ll long long
#define ull unsigned long long
#define debug(x) cerr<<#x<<"="<<x<<'\n'
//#define DEBUG

const int MOD=1e9+7;

int n,m;
vector<int> vec[300100],vec2[300100];
int visit[300100];
int par[300100];
int roat[300100],r;
pii edge[300100];

int find(int a)
{
	if(par[a]==a) return a;
	return par[a]=find(par[a]);
}

inline void dfs(int a,int p)
{
//	debug(a);
	visit[a]=1;
	roat[r++]=a;
//	for(int i=0;i<roat.size();i++) printf("%d ",roat[i]); puts("");
	for(int i=0;i<vec[a].size();i++)
	{
		int u=vec[a][i];
		if(u==p) continue;
		if(!visit[u])
			dfs(u,a);
		else if(visit[u]==1)
		{
//			debug(a);debug(u);
			int ppp=find(u);
			for(int j=r-1;j>=0;j--)
			{
				if(roat[j]==u) break;
				if(ppp==find(roat[j])) continue;
				par[roat[j]]=u;
			}
		}
	}
	visit[a]=2;
	roat[--r]=0;
}

int res=0;
inline int dfs2(int a,int p)
{
	visit[a]=1;
	int mx=0,mx2=0;
	for(int i=0;i<vec2[a].size();i++)
	{
		int u=vec2[a][i];
		if(u==p) continue;
		int t=dfs2(u,a);
		if(t>mx) mx2=mx,mx=t;
		else if(t>mx2) mx2=t;
	}
	res=max(res,mx+mx2);
	return mx+1;
}

int main()
{
	#ifdef DEBUG
	clock_t tStart = clock();
	#endif
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		vec[--a].PB(--b);
		vec[b].PB(a);
		edge[i]=MP(a,b);
	}
	for(int i=0;i<n;i++) par[i]=i;
	dfs(0,-1);
//	for(int i=0;i<n;i++) printf("par[%d]=%d\n",i,par[i]);
	for(int i=0;i<m;i++)
	{
		int a=find(edge[i].fi);
		int b=find(edge[i].se);
		if(a!=b)
		{
			vec2[a].PB(b);
			vec2[b].PB(a);
		}
	}
	memset(visit,0,sizeof(visit));
	for(int i=0;i<n;i++)
		if(!visit[i]&&par[i]==i)
			dfs2(i,-1);
	printf("%d\n",res);
	#ifdef DEBUG
	cerr<<"\nExecution time: "<<(((double)clock() - tStart)/CLOCKS_PER_SEC)*1e3<<"ms.\n";
	#endif
	return 0;
}
/*
9 10
1 2
2 3
3 4
1 5
5 7
7 9
7 8
8 9
5 6
2 4
*/


#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
inline char gc()
{
    static char now[1<<16],*s,*t;
    if(s==t) {t=(s=now)+fread(now,1,1<<16,stdin); if(s==t) return EOF;}
    return *s++;
}
inline int read()
{
    int x=0; char ch=gc();
    while(ch<'0'||'9'<ch) ch=gc();
    while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=gc();
    return x;
}
const int N=3e5+10;
int n,m;
vector<int> ed[N],ed1[N];
void edAdd(int u,int v) {ed[u].push_back(v),ed[v].push_back(u);}
void edAdd1(int u,int v) {ed1[u].push_back(v),ed1[v].push_back(u);}
int dfCnt,dfn[N],low[N];
int bccCnt,blg[N]; int st[N],top;
void tarjan(int u,int fa)
{
    dfn[u]=low[u]=++dfCnt; st[top++]=u;
    for(int i=0;i<ed[u].size();i++)
    {
        int v=ed[u][i];
        if(v==fa) continue;
        if(dfn[v]) low[u]=min(low[u],dfn[v]);
        else tarjan(v,u),low[u]=min(low[u],low[v]);
    }
    if(low[u]==dfn[u])
    {
        int t=++bccCnt;
        while(st[top]!=u) blg[st[--top]]=t;
    }
}
int dpt[N];
void dfs(int u,int fa)
{
    for(int i=0;i<ed1[u].size();i++)
    {
        int v=ed1[u][i];
        if(v!=fa) dpt[v]=dpt[u]+1,dfs(v,u);
    }
}
int main()
{
    n=read(),m=read();
    for(int i=1;i<=m;i++) edAdd(read(),read());
    tarjan(1,0);
    for(int u=1;u<=n;u++)
        for(int i=0;i<ed[u].size();i++)
        {
            int v=ed[u][i];
            if(blg[u]!=blg[v]) edAdd1(blg[u],blg[v]);
        }
    dpt[1]=0,dfs(1,0);
    int s=1;
    for(int u=1;u<=bccCnt;u++) if(dpt[u]>dpt[s]) s=u;
    dpt[s]=0,dfs(s,0);
    int ans=0;
    for(int u=1;u<=bccCnt;u++) ans=max(ans,dpt[u]);
    printf("%d\n",ans);
    return 0;
}


#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
inline char gc()
{
    static char now[1<<16],*s,*t;
    if(s==t) {t=(s=now)+fread(now,1,1<<16,stdin); if(s==t) return EOF;}
    return *s++;
}
inline int read()
{
    int x=0; char ch=gc();
    while(ch<'0'||'9'<ch) ch=gc();
    while('0'<=ch&&ch<='9') x=x*10+ch-'0',ch=gc();
    return x;
}
const int N=3e5+10;
int n,m;
vector<int> ed[N],ed1[N];
void edAdd(int u,int v) {ed[u].push_back(v),ed[v].push_back(u);}
void edAdd1(int u,int v) {ed1[u].push_back(v),ed1[v].push_back(u);}
int dfCnt,dfn[N],low[N];
int bccCnt,blg[N]; int st[N],top;
void tarjan(int u,int fa)
{
    dfn[u]=low[u]=++dfCnt; st[top++]=u;
    for(int i=0;i<ed[u].size();i++)
    {
        int v=ed[u][i];
        if(v==fa) continue;
        if(dfn[v]) low[u]=min(low[u],dfn[v]);
        else tarjan(v,u),low[u]=min(low[u],low[v]);
    }
    if(low[u]==dfn[u])
    {
        int t=++bccCnt;
        while(st[top]!=u) blg[st[--top]]=t;
    }
}
int dpt[N];
void dfs(int u,int fa)
{
    for(int i=0;i<ed1[u].size();i++)
    {
        int v=ed1[u][i];
        if(!dpt[v]&&v!=fa) dpt[v]=dpt[u]+1,dfs(v,u);
    }
}
int main()
{
    n=read(),m=read();
    for(int i=1;i<=m;i++) edAdd(read(),read());
    tarjan(1,0);
    for(int u=1;u<=n;u++)
        for(int i=0;i<ed[u].size();i++)
        {
            int v=ed[u][i];
            if(blg[u]!=blg[v]) edAdd1(blg[u],blg[v]);
        }
    memset(dpt,0,sizeof dpt),dfs(1,0);
    int s=1;
    for(int u=1;u<=bccCnt;u++) if(dpt[u]>dpt[s]) s=u;
    memset(dpt,0,sizeof dpt),dfs(s,0);
    int ans=0;
    for(int u=1;u<=bccCnt;u++) ans=max(ans,dpt[u]);
    printf("%d\n",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=100010,MAXM=100010;
int Head[MAXN],Next[MAXM*2],To[MAXM*2];
bool vis[MAXN];
int dfn[MAXN],low[MAXN];
int n,m,tot,tim,num_cutedge;
struct Edge{
    int u,v;
}cutedge[MAXM];

void add_eage(int x,int y)
{
    tot++;
    Next[tot]=Head[x];
    Head[x]=tot;
    To[tot]=y;
}
void ReadInfo()
{
    memset(Head,0,sizeof(Head));
    scanf("%d%d",&n,&m);
    tim=tot=0;
    for (int i=1;i<=m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        add_eage(x,y); add_eage(y,x);
    }
}
int bri[600005];
void Tarjan(int u,int id)
{
    dfn[u]=low[u]=++tim;
    vis[u]=true;
    for (int i=Head[u];i;i=Next[i])
    {
        int v=To[i];
        if (!vis[v])
        {
            Tarjan(v,i);
            low[u]=min(low[u],low[v]);
            if (dfn[u]<low[v])bri[i]=bri[((i-1)^1)+1]=1;
        }
        else if ((i+1)/2!=(id+1)/2) low[u]=min(low[u],dfn[v]);
    }
}
void solve()
{
    memset(dfn,-1,sizeof(dfn));
    memset(low,-1,sizeof(low));
    memset(vis,false,sizeof(vis));
    num_cutedge=0;
    for (int i=1;i<=n;i++)
        if (!vis[i]) Tarjan(i,0);
}
int dp[300005],ans,vvv[300005];
void dfs(int p){
	multiset<int> s; s.clear(); vvv[p]=1;
	for(int i=Head[p];i;i=Next[i]){
		int v=To[i];
		if(vvv[v])continue;
		dfs(v);
		//cout<<p<<" "<<v<<endl;
		dp[p]=max(dp[v]+bri[i],dp[p]); s.insert(dp[v]+bri[i]);
	}
	if(s.size()>=2){
		int t=*s.rbegin(); s.erase(s.find(t));
		ans=max(ans,t+*s.rbegin());
	}
}
int main()
{
    ReadInfo();
    solve();
    dfs(1);
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=300010,MAXM=300010;
int Head[MAXN],Next[MAXM*2],To[MAXM*2];
bool vis[MAXN];
int dfn[MAXN],low[MAXN];
int n,m,tot,tim,num_cutedge;
struct Edge{
    int u,v;
}cutedge[MAXM];

void add_eage(int x,int y)
{
    tot++;
    Next[tot]=Head[x];
    Head[x]=tot;
    To[tot]=y;
}
void ReadInfo()
{
    memset(Head,0,sizeof(Head));
    scanf("%d%d",&n,&m);
    tim=tot=0;
    for (int i=1;i<=m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        add_eage(x,y); add_eage(y,x);
    }
}
int bri[600005];
void Tarjan(int u,int id)
{
    dfn[u]=low[u]=++tim;
    vis[u]=true;
    for (int i=Head[u];i;i=Next[i])
    {
        int v=To[i];
        if (!vis[v])
        {
            Tarjan(v,i);
            low[u]=min(low[u],low[v]);
            if (dfn[u]<low[v])bri[i]=bri[((i-1)^1)+1]=1;
        }
        else if ((i+1)/2!=(id+1)/2) low[u]=min(low[u],dfn[v]);
    }
}
void solve()
{
    memset(dfn,-1,sizeof(dfn));
    memset(low,-1,sizeof(low));
    memset(vis,false,sizeof(vis));
    num_cutedge=0;
    for (int i=1;i<=n;i++)
        if (!vis[i]) Tarjan(i,0);
}
int dp[300005],ans,vvv[300005];
void dfs(int p){
	multiset<int> s; s.clear(); vvv[p]=1;
	for(int i=Head[p];i;i=Next[i]){
		int v=To[i];
		if(vvv[v])continue;
		dfs(v);
		//cout<<p<<" "<<v<<endl;
		dp[p]=max(dp[v]+bri[i],dp[p]); s.insert(dp[v]+bri[i]);
	}
	if(s.size()>=2){
		int t=*s.rbegin(); s.erase(s.find(t));
		ans=max(ans,t+*s.rbegin());
	}
	ans=max(ans,dp[p]);
}
int main()
{
    ReadInfo();
    solve();
    dfs(1);
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=100010,MAXM=100010;
int Head[MAXN],Next[MAXM*2],To[MAXM*2];
bool vis[MAXN];
int dfn[MAXN],low[MAXN];
int n,m,tot,tim,num_cutedge;
struct Edge{
    int u,v;
}cutedge[MAXM];

void add_eage(int x,int y)
{
    tot++;
    Next[tot]=Head[x];
    Head[x]=tot;
    To[tot]=y;
}
void ReadInfo()
{
    memset(Head,0,sizeof(Head));
    scanf("%d%d",&n,&m);
    tim=tot=0;
    for (int i=1;i<=m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        add_eage(x,y); add_eage(y,x);
    }
}
int bri[600005];
void Tarjan(int u,int id)
{
    dfn[u]=low[u]=++tim;
    vis[u]=true;
    for (int i=Head[u];i;i=Next[i])
    {
        int v=To[i];
        if (!vis[v])
        {
            Tarjan(v,i);
            low[u]=min(low[u],low[v]);
            if (dfn[u]<low[v])bri[i]=bri[((i-1)^1)+1]=1;
        }
        else if ((i+1)/2!=(id+1)/2) low[u]=min(low[u],dfn[v]);
    }
}
void solve()
{
    memset(dfn,-1,sizeof(dfn));
    memset(low,-1,sizeof(low));
    memset(vis,false,sizeof(vis));
    num_cutedge=0;
    for (int i=1;i<=n;i++)
        if (!vis[i]) Tarjan(i,0);
}
int dp[300005],ans,vvv[300005];
void dfs(int p){
	multiset<int> s; s.clear(); vvv[p]=1;
	for(int i=Head[p];i;i=Next[i]){
		int v=To[i];
		if(vvv[v])continue;
		dfs(v);
		//cout<<p<<" "<<v<<endl;
		dp[p]=max(dp[v]+bri[i],dp[p]); s.insert(dp[v]+bri[i]);
	}
	if(s.size()>=2){
		int t=*s.rbegin(); s.erase(s.find(t));
		ans=max(ans,t+*s.rbegin());
	}
	ans=max(ans,dp[p]);
}
int main()
{
    ReadInfo();
    solve();
    dfs(1);
    cout<<ans<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=500010,MAXM=500010;
int Head[MAXN],Next[MAXM*2],To[MAXM*2];
bool vis[MAXN];
int dfn[MAXN],low[MAXN];
int n,m,tot,tim,num_cutedge;
struct Edge{
    int u,v;
}cutedge[MAXM];

void add_eage(int x,int y)
{
    tot++;
    Next[tot]=Head[x];
    Head[x]=tot;
    To[tot]=y;
}
void ReadInfo()
{
    memset(Head,0,sizeof(Head));
    scanf("%d%d",&n,&m);
    tim=tot=0;
    for (int i=1;i<=m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        add_eage(x,y); add_eage(y,x);
    }
}
void Tarjan(int u,int id)
{
    dfn[u]=low[u]=++tim;
    vis[u]=true;
    for (int i=Head[u];i;i=Next[i])
    {
        int v=To[i];
        if (!vis[v])
        {
            Tarjan(v,i);
            low[u]=min(low[u],low[v]);
            if (dfn[u]<low[v]) ++num_cutedge;
        }
        else if ((i+1)/2!=(id+1)/2) low[u]=min(low[u],dfn[v]);
    }
}
void solve()
{
    memset(dfn,-1,sizeof(dfn));
    memset(low,-1,sizeof(low));
    memset(vis,false,sizeof(vis));
    num_cutedge=0;
    for (int i=1;i<=n;i++)
        if (!vis[i]) Tarjan(i,0);
}
int main()
{
    ReadInfo();
    solve();
    cout<<num_cutedge<<endl;
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <map>
using namespace std;

struct edge{int next,to;};
edge G[600100];
int head[300100],DFN[300100],LOW[300100],ID[300100];
edge T[600100];
int Thead[300100];
bool Bridge[600100],vis[300100];
int N,M,cnt=2,DCC_Index=0,Index=0,Tcnt=2;

inline void Add_Edge(int u,int v){
	G[cnt].to=v;
	G[cnt].next=head[u];
	head[u]=cnt++;
	return;
}

inline void Add_EdgeT(int u,int v){
	T[Tcnt].to=v;
	T[Tcnt].next=Thead[u];
	Thead[u]=Tcnt++;
	return;
}

void Tarjan(int u,int in_edge){
	DFN[u]=LOW[u]=++Index;
	for(int i=head[u];i;i=G[i].next){
		int v=G[i].to;
		if(!DFN[v]){
			Tarjan(v,i);
			LOW[u]=min(LOW[u],LOW[v]);
			if(LOW[v]>DFN[u]) Bridge[i]=Bridge[i^1]=true;
		}
		else if(i!=(in_edge^1))
			LOW[u]=min(LOW[u],DFN[v]);
	}
	return;
}

void DFS(int u){
	ID[u]=DCC_Index;
	for(int i=head[u];i;i=G[i].next){
		int v=G[i].to;
		if(ID[v] || Bridge[i]) continue;
		DFS(v);
	}
	return;
}

int MaxDis,MaxNode;

void DFSA(int u,int fa,int deep){
	vis[u]=true;
	if(deep>MaxDis){MaxDis=deep;MaxNode=u;}
	for(int i=Thead[u];i;i=T[i].next){
		int v=T[i].to;
		if(v==fa) continue;
		DFSA(v,u,deep+1);
	}
	return;
}

int main(){
	scanf("%d%d",&N,&M);
	for(register int i=1;i<=M;++i){
		int u,v;
		scanf("%d%d",&u,&v);
		Add_Edge(u,v);
		Add_Edge(v,u);
	}
	for(register int i=1;i<=N;++i)
		if(!DFN[i]) Tarjan(i,0);
	for(register int i=1;i<=N;++i)
		if(!ID[i]){++DCC_Index;DFS(i);}
	for(register int i=2;i<cnt;++i){
		int u=G[i^1].to,v=G[i].to;
		if(ID[u]==ID[v]) continue;
		Add_EdgeT(ID[u],ID[v]);
	}
	int Ans=0;
	MaxDis=-1;MaxNode=0;
	DFSA(1,0,0);
	MaxDis=-1;
	DFSA(MaxNode,0,0);
	Ans=max(Ans,MaxDis);
	printf("%d\n",Ans);

	return 0;
}


#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <queue>

#define MAXN 300005

using namespace std;

struct Edge {
    int v, id, next;
}edge[MAXN * 2];
int e, ft[MAXN];

int n, cnt, dfn[MAXN], low[MAXN], dp[MAXN];
int ans;

void init()
{
    cnt = 0;
    ans = 0;
    memset(dfn, 0, sizeof(dfn));
    e = 0;
    memset(ft, -1, sizeof(ft));
}

void add_edge(int u, int v, int id)
{
    edge[e].v = v;
    edge[e].id = id;
    edge[e].next = ft[u];
    ft[u] = e++;
}

void dfs(int u, int fromId)
{
    dfn[u] = low[u] = ++cnt;
    dp[u] = 0;
    for (int i = ft[u]; i != -1; i = edge[i].next) {
        int v = edge[i].v;
        if (edge[i].id == fromId)
            continue;
        if (dfn[v] > 0) {
            low[u] = min(low[u], dfn[v]);
        } else {
            dfs(v, edge[i].id);
            low[u] = min(low[u], low[v]);
            int w = (low[v] == dfn[v] ? 1 : 0);
            ans = max(ans, dp[u] + dp[v] + w);
            dp[u] = max(dp[u], dp[v] + w);
        }
    }
}

int main()
{
    //freopen("e.txt", "r", stdin);
    int m, u, v;
    while (cin >> n >> m) {
        init();
        for (int i = 0; i < m; i++) {
            scanf("%d%d", &u, &v);
            add_edge(u, v, i);
            add_edge(v, u, i);
        }
        dfs(1, -1);
        cout << ans << endl;
    }
    return 0;

}


#include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long
#define ld long double
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define sc(x) scanf("%s",x)
#define pd(t) printf("%d\n",t)
#define plld(t) printf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb(x) push_back(x)
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define clr(a,b) memset(a,b,sizeof(a))
#define sws ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pi acos(-1)
#define rep(I, N) for (int I = 0; I < (N); ++I)
#define repp(I, a, B) for (int I = (a); I <= (B); ++I)
#define t1(x)                cout<<#x<<": "<<x<<endl
#define t2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define t3(x, y, z)          cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define t4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define t5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define t6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
using namespace std;

const int N = 3e5 + 5;
const int M = 3e5 + 5;
const int LN = 30;

int n, m;
int node = 1;
int diameter, ans;
int timer = 0;
int grp = 0;
int u[N];
int v[N];
int vis[N];
int isBridge[M];
int tin[N];
int tout[N];
int minAncestor[N];
queue<int> Q[N];
vector<int> adj[N], tree[N];
int nodegrp[N];

void dfs1(int node, int par)
{
    vis[node] = 1;
    tin[node] = minAncestor[node] = ++timer;
    for(int i = 0; i < adj[node].size(); i++)
    {
        int edge = adj[node][i];
        if(par == edge)
        {
            continue;
        }
        int next = u[edge] ^ v[edge] ^ node;
        if(!vis[next])
        {
            dfs1(next , edge);
            minAncestor[node] = min(minAncestor[node] , minAncestor[next]);
        }
        else
        {
            minAncestor[node] = min(minAncestor[node] , tin[next]);
        }
        if(minAncestor[next] > tin[node])
        {
            isBridge[edge] = 1;
        }
    }
    tout[node] = timer;
    /*vis[node]=1;
    tin[node]=timer++;
    int dbe = tin[node];
    for(int i=0;i<(int)adj[node].size();i++)
    {
        int e = adj[node][i].ss;
        int w = adj[node][i].ff;
        if(!vis[w])
            dbe = min(dbe,dfs1(w,e));
        else if(e!=par)
            dbe = min(dbe,tin[w]);
    }
    if(dbe == tin[node] && par!=-1)
        isBridge[par]=true;
    return dbe;*/
}

void dfs2(int node)
{
    int comp = grp;
    Q[comp].push(node);
    vis[node] = 1;
    while(!Q[comp].empty())
    {
        int _node = Q[comp].front();
        Q[comp].pop();
        nodegrp[_node] = comp;
        for(int i = 0; i < adj[_node].size(); i++)
        {
            int edge = adj[_node][i];
            int next = u[edge] ^ v[edge] ^ _node;
            if(vis[next])
                continue;
            if(isBridge[edge])
            {
                grp++;
                tree[comp].push_back(grp);
                tree[grp].push_back(comp);
                dfs2(next);
            }
            else
            {
                Q[comp].push(next);
                vis[next] = 1;
            }
        }
    }
}

void dfs3(int u, int par, int level)
{
    if(level > diameter)
    {
        diameter = level;
        node = u;
    }
    for(int i = 0; i < tree[u].size(); i++)
    {
        if(tree[u][i] != par)
            dfs3(tree[u][i], u, level + 1);
    }
}

int getdiameter(int node, int par)
{
    int m = 0, M = 0;
    vis[node] = 1;
    for(int i = 0; i < tree[node].size(); i++)
    {
        int next = tree[node][i];
        if(next != par)
        {
            int d = getdiameter(next, node) + 1;
            if(d > M)
            {
                m = M;
                M = d;
            }
            else if(d > m)
            {
                m = d;
            }
        }
    }
    ans = max(ans, M + m);
    return M;
}

int main()
{
    sws;
    cout << fixed << setprecision(10);
    clock_t clk;
    clk = clock();

    //freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

    cin >> n >> m;
    repp(i,1,m)
    {
        cin >> u[i] >> v[i];
        adj[u[i]].push_back(i);
        adj[v[i]].push_back(i);
    }
    repp(i,1,n)  if(!vis[i]) dfs1(i, 0);
    clr(vis, 0);
    repp(i,1,n) if(!vis[i])
    {
        ++grp;
        dfs2(i);
    }
    dfs3(1, 0, 0);
    dfs3(node, 0, 0);
    clr(vis, 0);
    repp(i,1,grp) if(!vis[i]) getdiameter(1, 0);
    assert(diameter == ans);
    cout << ans;

    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";

    return 0;
}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(_) ((_)*(_))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzl(x))

#define bctzl(x) (__builtin_ctzl(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}

template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {

	for(; b; b>>=1, a=1LL*a*a%m) if(b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 300010

#define MM 300010

int head[NN], nxt[MM<<1], no[MM<<1], to[MM<<1], E;

int vst[NN], st[NN], bel[NN], low[NN];

int ind, cnt, top;

void init(int n) {

	E=ind=cnt=0;

	for(int i=1; i<=n; i++) {

		head[i]=-1;

		vst[i]=0;

	}

}

void add(int u, int v) {

	nxt[E]=head[u]; no[E]=u; to[E]=v; head[u]=E++;

}

void Tarjan(int u, int pre=-1) {

	vst[u]=low[u]=++ind;

	st[++top]=u;

	for(int e=head[u]; ~e; e=nxt[e]) {

		int v=to[e];

		if(vst[v]==0) {

			Tarjan(v, e);

			smin(low[u], low[v]);

		}

		else if((e^pre)!=1) {

			smin(low[u], vst[v]);

		}

	}

	if(vst[u]==low[u]) {

		++cnt;

		while(1) {

			bel[st[top]]=cnt;

			if(st[top--]==u) break;

		}

	}

}

int d[NN], a, b;

VI adj[NN];

void bfs(int u) {

	queue<int> q;

	q.push(u);

	memset(d, inf, sizeof d);

	d[u]=0;

	int mx=-1, id;

	while(!q.empty()) {

		u=q.front(); q.pop();

		if(d[u]>mx) {

			mx=d[u];

			id=u;

		}

		for(int i=adj[u].size(); i--; ) {

			int v=adj[u][i];

			if(d[v]>d[u]+1) {

				d[v]=d[u]+1;

				q.push(v);

			}

		}

	}

	memset(d, inf, sizeof d);

	d[id]=0;

	q.push(id);

	while(!q.empty()) {

		u=q.front(); q.pop();

		smax(mx, d[u]);

		for(int i=adj[u].size(); i--; ) {

			int v=adj[u][i];

			if(d[v]>d[u]+1) {

				d[v]=d[u]+1;

				q.push(v);

			}

		}

	}

	println(mx);

}

int main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n, m;

	gn(n, m);

	init(n);

	while(m--) {

		int u, v;

		gn(u, v);

		add(u, v);

		add(v, u);

	}

	for(int i=1; i<=n; i++) if(!vst[i]) {

		Tarjan(i);

	}

	for(int e=0; e<E; e++) {

		int u=no[e], v=to[e];

		u=bel[u], v=bel[v];

		if(u!=v) {

			adj[u].pb(v);

			adj[v].pb(u);

		}

	}

	bfs(1);

}