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

public class C implements Runnable
{
    @Override
    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        String q = in.nextLine(); // Scanner has functions to read ints, longs, strings, chars, etc.

        getRes(w, q);

        w.flush();
        w.close();
    }

    private static void getRes(PrintWriter w, String s) {
        //find two stacks of characters that have max multiplication
        //26*26*n
        int l = s.length();
        int[][] count = new int[l + 1][26];
        for (int i = 1; i <= l; i++) {
            int c = s.charAt(i - 1) - 'a';
            for (int k = 0; k < 26; k++) {
                count[i][k] = k == c ? count[i - 1][k] + 1 : count[i - 1][k];
            }
        }

        long res = 0;

        for (int k = 0; k < 26; k++) {
            res = Math.max(res, count[l][k]);
        }

        for (int i = 0; i < 26; i++) {
            for (int j = 0; j < 26; j++) {
                long temp = 0;
                for (int k = 1; k <= l; k++) {
                    int c = s.charAt(k - 1) - 'a';
                    if (c == i) {
                        temp += count[l][j] - count[k][j];
                    }
                }
                res = Math.max(res, temp);
            }
        }

        w.println(res);
    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new C(),"Main",1<<27).start();
    }

}


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

public class C implements Runnable
{
    @Override
    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        String q = in.nextLine(); // Scanner has functions to read ints, longs, strings, chars, etc.

        getRes(w, q);

        w.flush();
        w.close();
    }

    private static void getRes(PrintWriter w, String s) {
        //find two stacks of characters that have max multiplication
        //26*26*n
        int l = s.length();
        int[][] count = new int[l + 1][26];
        for (int i = 1; i <= l; i++) {
            int c = s.charAt(i - 1) - 'a';
            for (int k = 0; k < 26; k++) {
                count[i][k] = k == c ? count[i - 1][k] + 1 : count[i - 1][k];
            }
        }

        int res = 0;

        for (int k = 0; k < 26; k++) {
            res = Math.max(res, count[l][k]);
        }

        for (int i = 1; i <= l; i++) {
            int left = 0;
            int right = 0;
            for (int k = 0; k < 26; k++) {
                left = Math.max(left, count[i][k]);
                right = Math.max(right,count[l][k] - count[i][k]);
            }
            res = Math.max(res, left * right);
        }
        w.println(res);
    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new C(),"Main",1<<27).start();
    }

}


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

public class C implements Runnable
{
    @Override
    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        String q = in.nextLine(); // Scanner has functions to read ints, longs, strings, chars, etc.

        getRes(w, q);

        w.flush();
        w.close();
    }

    private static void getRes(PrintWriter w, String s) {
        //find two stacks of characters that have max multiplication
        //26*26*n
        int l = s.length();
        int[][] count = new int[l + 1][26];
        for (int i = 1; i <= l; i++) {
            int c = s.charAt(i - 1) - 'a';
            for (int k = 0; k < 26; k++) {
                count[i][k] = k == c ? count[i - 1][k] + 1 : count[i - 1][k];
            }
        }

        long res = 0;

        for (int k = 0; k < 26; k++) {
            res = Math.max(res, count[l][k]);
        }

        for (int i = 1; i <= l; i++) {
            long left = 0;
            long right = 0;
            for (int k = 0; k < 26; k++) {
                left = Math.max(left, count[i][k]);
                right = Math.max(right,count[l][k] - count[i][k]);
            }
            res = Math.max(res, left * right);
        }
        w.println(res);
    }

    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new C(),"Main",1<<27).start();
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCowAndMessage solver = new CCowAndMessage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCowAndMessage {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char[] c = s.next().toCharArray();
            int n = c.length;
            long[][] dp = new long[26][26];
            long[] f = new long[26];
            long ans = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 26; j++) {
                    dp[j][c[i] - 'a'] += f[j];
                    ans = Math.max(ans, dp[j][c[i] - 'a']);
                }
                f[c[i] - 'a']++;
            }
            ans = Math.max(ans, func.max(f));
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class func {
        public static long max(long... v) {
            long max = Integer.MIN_VALUE;
            for (long i : v) max = Math.max(max, i);
            return max;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCowAndMessage solver = new CCowAndMessage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCowAndMessage {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            char[] c = s.next().toCharArray();
            int n = c.length;
            long[][] dp = new long[26][26];
            long[] f = new long[26];
            long ans = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 26; j++) dp[j][c[i] - 'a'] += f[j];
                f[c[i] - 'a']++;
            }
            for (int i = 0; i < 26; i++) for (int j = 0; j < 26; j++) ans = Math.max(ans, dp[i][j]);
            ans = Math.max(ans, func.max(f));
            w.println(ans);
        }

    }

    static class func {
        public static long max(long... v) {
            long max = Integer.MIN_VALUE;
            for (long i : v) max = Math.max(max, i);
            return max;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCowAndMessage solver = new CCowAndMessage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCowAndMessage {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            long[] f = new long[26], cur = new long[26];
            char[] c = s.next().toCharArray();
            int n = c.length;
            for (int i = 0; i < n; i++) f[c[i] - 'a']++;
            long ans = func.max(f);
            if (ans > 2)
                ans = Math.max(ans, ans * (ans - 1) >> 1);
            for (int i = 0; i < n; i++) {
                f[c[i] - 'a']--;
                cur[c[i] - 'a']++;
                for (int j = 0; j < 26; j++)
                    for (int k = 0; k < 26; k++) ans = Math.max(ans, cur[j] * f[k]);
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class func {
        public static long max(long... v) {
            long max = Integer.MIN_VALUE;
            for (long i : v) max = Math.max(max, i);
            return max;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCowAndMessage solver = new CCowAndMessage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCowAndMessage {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            long[] f = new long[26], cur = new long[26];
            char[] c = s.next().toCharArray();
            int n = c.length;
            for (int i = 0; i < n; i++) f[c[i] - 'a']++;
            long ans = func.max(f);
            for (int i = 0; i < n; i++) {
                f[c[i] - 'a']--;
                cur[c[i] - 'a']++;
                for (int j = 0; j < 26; j++)
                    for (int k = 0; k < 26; k++) ans = Math.max(ans, cur[j] * f[k]);
            }
            w.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class func {
        public static long max(long... v) {
            long max = Integer.MIN_VALUE;
            for (long i : v) max = Math.max(max, i);
            return max;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCowAndMessage solver = new CCowAndMessage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCowAndMessage {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            long[] f = new long[26], cur = new long[26];
            char[] c = s.next().toCharArray();
            int n = c.length;
            for (int i = 0; i < n; i++) f[c[i] - 'a']++;
            long ans = func.max(f);
            for (int i = 0; i < n; i++) {
                f[c[i] - 'a']--;
                cur[c[i] - 'a']++;
                for (int j = 0; j < 26; j++)
                    for (int k = j; k < 26; k++) ans = Math.max(ans, cur[j] * f[k]);
            }
            w.println(ans);
        }

    }

    static class func {
        public static long max(long... v) {
            long max = Integer.MIN_VALUE;
            for (long i : v) max = Math.max(max, i);
            return max;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author KharYusuf
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCowAndMessage solver = new CCowAndMessage();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCowAndMessage {
        public void solve(int testNumber, FastReader s, PrintWriter w) {
            long[] f = new long[26], cur = new long[26];
            char[] c = s.next().toCharArray();
            int n = c.length;
            for (int i = 0; i < n; i++) f[c[i] - 'a']++;
            long ans = func.max(f);
            for (int i = 0; i < n; i++) {
                f[c[i] - 'a']--;
                cur[c[i] - 'a']++;
                for (int j = 0; j < 26; j++)
                    for (int k = j + 1; k < 26; k++) ans = Math.max(ans, cur[j] * f[k]);
            }
            w.println(ans);
        }

    }

    static class func {
        public static long max(long... v) {
            long max = Integer.MIN_VALUE;
            for (long i : v) max = Math.max(max, i);
            return max;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


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

public class HelloWorld {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        int max = 0;
        HashMap<String, Integer> freq = new HashMap<>();
        for(int i = 0; i < str.length(); i++) {
            for(int k = i + 1; k < str.length(); k++) {
                String newStr = str.charAt(i) + "" + str.charAt(k);
                if(freq.containsKey(newStr)) {
                    freq.put(newStr, freq.get(newStr) + 1);
                } else {
                    freq.put(newStr, 1);
                }
                max = Math.max(max, freq.get(newStr));
            }
        }
        for(int i = 0; i < str.length(); i++) {
            String newStr = str.charAt(i) + "";
            if(freq.containsKey(newStr)) {
                freq.put(newStr, freq.get(newStr) + 1);
            } else {
                freq.put(newStr, 1);
            }
            max = Math.max(max, freq.get(newStr));
        }
        System.out.println(max);
    }
}


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

public class HelloWorld {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        long[] freq = new long[26];
        HashMap<String, Long> sub = new HashMap<>();
        long max = 0;
        for (int i = 0; i < str.length(); i++) {
            char curr = str.charAt(i);
            for (int k = 0; k < freq.length; k++) {
                if (freq[k] > 0) {
                    char newVal = (char) (k + 'a');
                    String newStr = newVal + "" + curr;
                    if (sub.containsKey(newStr)) {
                        sub.put(newStr, sub.get(newStr) + freq[k]);
                    } else {
                        sub.put(newStr, freq[k]);
                    }
                    max = Math.max(max, sub.get(newStr));
                }
            }
            freq[curr - 'a']++;
        }
        for (int i = 0; i < freq.length; i++) {
            max = Math.max(freq[i], max);
        }
        System.out.println(max);
    }
}


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

public class HelloWorld {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();
        int[] freq = new int[26];
        HashMap<String, Integer> sub = new HashMap<>();
        int max = 0;
        for(int i = 0; i < str.length(); i++) {
            char curr = str.charAt(i);
            for(int k = 0; k < freq.length; k++) {
                if(freq[k] > 0) {
                    char newVal = (char)(k + 'a');
                    String newStr = newVal + "" + curr;
                    if(sub.containsKey(newStr)) {
                        sub.put(newStr, sub.get(newStr) + freq[k]);
                    } else {
                        sub.put(newStr, freq[k]);
                    }
                    max = Math.max(max, sub.get(newStr));
                }
            }
            freq[curr - 'a']++;
        }
        for(int i = 0; i < freq.length; i++) {
            max = Math.max(freq[i], max);
        }
        System.out.println(max);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		in.nextToken();
		String s1 = in.sval;
		int length = s1.length();
		int[][] numLine = new int[length][26];
		for(int i = 0; i < s1.length(); i++)    numLine[i][s1.charAt(i) - 'a']++;
		for(int i = s1.length() - 2; i >= 0; i--)
			for(int j = 0; j < 26; j++)    numLine[i][j] += numLine[i + 1][j];
		long numMax = 0;
		for(int i = 0; i < 26; i++)    numMax = numMax > numLine[0][i] ? numMax : numLine[0][i];
		numMax = (numMax - 1) * numMax / 2 > numMax ? (numMax - 1) * numMax / 2 : numMax;
		for(int i = 0; i < 26; i++)
		{
			for(int j = 0; j < 26; j++)
			{
				if(i == j)    continue;
				long tempMax = 0;
				for(int k = 0; k < s1.length(); k++)
					if(s1.charAt(k) == i + 'a')    tempMax += numLine[k][j];
				numMax = numMax > tempMax ? numMax : tempMax;
			}
		}
		out.println(numMax);
		out.flush();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		in.nextToken();
		String s1 = in.sval;
		int length = s1.length();
		int[][] numLine = new int[length][26];
		for(int i = 0; i < s1.length(); i++)    numLine[i][s1.charAt(i) - 'a']++;
		for(int i = s1.length() - 2; i >= 0; i--)
			for(int j = 0; j < 26; j++)    numLine[i][j] += numLine[i + 1][j];
		long numMax = 0;
		for(int i = 0; i < 26; i++)    numMax = numMax > numLine[0][i] ? numMax : numLine[0][i];
		numMax = (numMax - 1) * numMax / 2;
		for(int i = 0; i < 26; i++)
		{
			for(int j = 0; j < 26; j++)
			{
				if(i == j)    continue;
				long tempMax = 0;
				for(int k = 0; k < s1.length(); k++)
					if(s1.charAt(k) == i + 'a')    tempMax += numLine[k][j];
				numMax = numMax > tempMax ? numMax : tempMax;
			}
		}
		out.println(numMax);
		out.flush();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		in.nextToken();
		String s1 = in.sval;
		int length = s1.length();
		int[][] numLine = new int[length][26];
		for(int i = 0; i < s1.length(); i++)    numLine[i][s1.charAt(i) - 'a']++;
		for(int i = s1.length() - 2; i >= 0; i--)
			for(int j = 0; j < 26; j++)    numLine[i][j] += numLine[i + 1][j];
		long numMax = 0;
		for(int i = 0; i < 26; i++)    numMax = numMax > numLine[0][i] ? numMax : numLine[0][i];
		for(int i = 0; i < 26; i++)
		{
			for(int j = 0; j < 26; j++)
			{
				if(i == j)    continue;
				long tempMax = 0;
				for(int k = 0; k < s1.length(); k++)
					if(s1.charAt(k) == i + 'a')    tempMax += numLine[k][j];
				numMax = numMax > tempMax ? numMax : tempMax;
			}
		}
		out.println(numMax);
		out.flush();
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
struct node{
	int num,pos;
}a[3000005];
bool cmp(node x,node y){
	return x.num<y.num;
}
signed main(){
	int n,k,l,r,d=1000000007;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].num;
		a[i].pos=i;
	}
	sort(a+1,a+n+1,cmp);
	cin>>k;
	queue<int> q;
	int i;
	for(i=1;i<=k;i++){
		q.push(a[i].num);
	}
	while(i<=n+1){
		if(llabs(q.back()-q.front())<d){
			d=llabs(q.back()-q.front());
			l=i-k;
			r=i-1;
		}
		if(i>n) break;
		q.pop();
		q.push(a[i].num);
		i++;
	}
	for(int i=l;i<=r;i++){
		cout<<a[i].pos<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
struct node{
	int num,qi;
}a[3000005];
bool cmp(node x,node y){
	return x.num<y.num;
}
signed main() {
	int n,k,ld=1e9+7,ldf,lde;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].num;
		a[i].qi=i;
	}
	sort(a+1,a+n+1,cmp);
	cin>>k;
	queue<int> q;
	int i;
	for(i=1;i<=k;i++){
		q.push(a[i].num);
	}
	while(i<=n+1){
		if(llabs(q.back()-q.front())<ld){
			ld=llabs(q.back()-q.front());
			ldf=i-k;
			lde=i-1;
		}
		if(i>n){
			break;
		}
		q.pop();
		q.push(a[i].num);
		i++;
	}
	for(int j=ldf;j<=lde;j++){
		cout<<a[j].qi<<" ";
	}
	return 0;
}


/*
    Nishant Singh
    nishant.ns19
*/
#include <bits/stdc++.h>
#include <functional>
#include <iostream>

// ******** Big Integer ********
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// #define ll1024  int1024_t
// ******** Big Integer ********

// ******** Using PBDS ********
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// ******** Using PBDS ********

using namespace std;
#define ll long long
#define ld long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vll vector<ll>
#define vec vector
#define setcount(x) __builtin_popcountll(x)
#define f first
#define s second
#define mp make_pair
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define REV(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define in insert
#define init(x,a) memset(x,a,sizeof(x))
#define all(c) c.begin(),c.end()
#define pq priority_queue
#define ffl fflush(stdout)
#define mset multiset
#define out(x) cout<<#x<<" = "<<" "<<x<<"\n";
#define ub upper_bound
#define lb lower_bound
#define ln "\n"
#define Y "YES"
#define N "NO"
ll const mod=1e9 + 7;
ll const inf=2e18;

// ******** Using PBDS ********
// typedef tree<long long, null_type, less<long long>, rb_tree_tag,
//              tree_order_statistics_node_update>
//                 os;
// ******** Using PBDS ********

inline ll add(ll a,ll b)
{
    return (a%mod + b%mod + mod)%mod;
}

inline ll mul(ll a,ll b)
{
    return (a%mod * b%mod + mod)%mod;
}

inline ll sub(ll a,ll b)
{
    return (a%mod - b%mod + mod)%mod;
}

ll gcd(ll a,ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll modexp(ll x, ll n){
    if(n==0){
        return 1;
    }
    else if(n&1){
        return (modexp((x*x)%mod, n/2)%mod * x%mod)%mod;
    }
    else{
        return (modexp((x*x)%mod, n/2)%mod);
    }
}

ll modinv(ll n)
{
    return modexp(n,mod-2);
}

// ******** GLOBAL VARIABLES ********

// ******** GLOBAL VARIABLES ********

void solve(){
    ll n,k;
    cin>>n;
    pll a[n];
    REP(i,n)
    {
            cin>>a[i].f;
            a[i].s=i;
    }
    sort(a,a+n);
    ll sum[n];
    REP(i,n)
    {
        if(i==0)
            sum[i]=a[i].f;
        else
            sum[i]=sum[i-1]+a[i].f;
    }
    cin>>k;
    ll cur=0;
    for(int i=1;i<k;i++)
    {
        cur=cur+((a[i].f*i)-(sum[i-1]));
     //   cout<<a[i]*i<<" "<<sum[i-1]<<endl;
    }
    ll id=0;
    ll ans=cur;
    for(int i=k;i<n;i++)
    {
        cur=cur-((sum[i-1]-sum[i-k])-((k-1)*a[i-k].f));
        cur=cur+((k-1)*a[i].f-((sum[i-1]-sum[i-k])));
        if(cur<ans)
        {
            ans=cur;
            id=i-k+1;
        }
        // cout<<i<<endl;
    }
    set<ll> s;
    for(int i=id;i<(id+k);i++)
    {
        s.in(a[i].s);
    }
    for(auto it:s)
        cout<<it+1<<" ";

}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll T=1;
    // cin>>T;
    for(int t=1;t<=T;t++)
    {
        // cout<<"Case #"<<t<<": ";
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

const int NMAX = 3e5 + 10;
int n,k;
pair < int, int > v[NMAX];

bool cmp(pair < int, int > &X, pair < int, int > &Y){
    return X.first < Y.first;
}

int main(){
    Boost();
    int i,j;
    cin >> n;
    for(i = 1 ; i <= n ; i++)
        cin >> v[i].first, v[i].second = i;
    sort(v + 1, v + n + 1, cmp);
    cin >> k;
    k = n - k;
    i = 1;
    j = n;
    while(k--){
        if(v[i + 1].first - v[i].first > v[j].first - v[j - 1].first)
            i++;
        else
            j--;
    }

    for( ; i <= j ; i++)
        cout << v[i].second << " ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

const int NMAX = 3e5 + 10;
int v[NMAX],n,k;

int main(){
    Boost();
    int i,j;
    cin >> n;
    for(i = 1 ; i <= n ; i++)
        cin >> v[i];
    cin >> k;
    k = n - k;
    i = 1;
    j = n;
    while(k--){
        if(v[i + 1] - v[i] > v[j] - v[j - 1])
            i++;
        else
            j--;
    }

    for( ; i <= j ; i++)
        cout << i << " ";

    return 0;
}


///the lazy propagation can't be trusted
#include <bits/stdc++.h>

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

const int NMAX = 3e5 + 10;
int v[NMAX],n,k;

int main(){
    Boost();
    int i,j;
    cin >> n;
    for(i = 1 ; i <= n ; i++)
        cin >> v[i];
    cin >> k;
    k = n - k;
    i = 1;
    j = n;
    while(k--){
        if(v[i + 1] - v[i] > v[j] - v[j - 1])
            i++;
        else
            j++;
    }

    for( ; i <= j ; i++)
        cout << i << " ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

const int NMAX = 3e5 + 10;
int v[NMAX],n,k;

int main(){
    Boost();
    int i,j;
    cin >> n;
    for(i = 1 ; i <= n ; i++)
        cin >> v[i];
    sort(v + 1, v + n + 1);
    cin >> k;
    k = n - k;
    i = 1;
    j = n;
    while(k--){
        if(v[i + 1] - v[i] > v[j] - v[j - 1])
            i++;
        else
            j--;
    }

    for( ; i <= j ; i++)
        cout << i << " ";

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

inline void Boost() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

const int NMAX = 3e5 + 10;
int n,k;
pair< long long, long long > a[NMAX];
long long sum[NMAX];
long long ans = 0;

long long Sum(int first, int last){
    return sum[last] - sum[first - 1];
}

int main(){
    Boost();
    int i,j;
    cin >> n;
    for(i = 1 ; i <= n ; i++){
        cin >> a[i].first;
        a[i].second = i;
    }

    sort(a + 1, a + n + 1);

    for(i = 1 ; i <= n ; i++)
        sum[i] = sum[i - 1] + a[i].first;

    cin >> k;
    int id = k;
    long long total = 0;
    for(i = 1 ; i <= k ; i++)
        total += a[i].first * (-((k - 1) - (i - 1)) + (i - 1));

    ans = total;
    for(i = k + 1 ; i <= n ; i++){
        total += a[i - k].first * (k - 1);
        total += Sum(i - k + 1, i - 1) * (-2ll  );
        total += a[i].first * (k - 1);
        ans = min(ans, total);
        if(total == ans)
            id = i;
    }

    for(i = id - k + 1 ; i <= id ; i++)
        cout << a[i].second << " ";

    return 0;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(998244353)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e18+5LL
# define LG 20
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 1e6+2
# define maxn 300005
# define offset 100005

/*************************************************
struct Coupon {
    ll l;
    ll r;
    ll id;

    Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

    bool operator<(const Coupon& c) { // Sorting
        return l < c.l;
    }
};

**************************************************/
ll a[maxn];
pair<ll,ll>b[maxn];
ll k;
ll cf[maxn];

ll sum(ll l,ll r)
{
   if((l-1)>=0)
    return cf[r]-cf[l-1];
   return cf[r];
}

int main()
{
  IOS;
  int n;
  cin >> n;
  ll sum1=0;
  for(int i=0;i<n;i++)
    {
       cin >> a[i];
       b[i].ff=a[i];
       b[i].ss=i;
    }
  cin >> k;
  sort(a,a+n);
  sort(b,b+n);

  for(int i=0;i<n;i++)
  {
    sum1+=a[i];
    cf[i]=sum1;
  }
  ll temp=0;
  for(int i=2;i<=k;i++)
  {
     temp=temp+a[i-1]*(i-1)-sum(0,i-2);
  }

 //trace1(temp);
 ll  ans=temp;
 ll  st=0;

  for(int i=1;i<=(n-k);i++)
  {
     temp=temp-(sum(i,i+k-2)-a[i-1]*(k-1))+(a[i+k-1]*(k-1)-sum(i,i+k-2));
     //trace3(i,i+k-2,sum(i,i+k-2));
     //trace2(i,temp);
     if(temp<ans)
     {
       ans=temp;
       st=i;
     }
  }

  for(int i=st;i<st+k;i++)
  {
     cout << b[i].ss+1<<" ";
  }
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<long long, long long> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> ii;
typedef vector<pair<ll,ll> > vii;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<pair<long long,long long> > vpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<ll,pair<ll,ll> > iii;
#define PI 3.141592653589793
#define mod (ll)(998244353)
//# define N 300005
template<typename T> T gcd(T a,T b) { if(a==0) return b; return gcd(b%a,a); }
template<typename T> T pow(T a,T b, ll m){T ans=1; while(b>0){ if(b%2==1) ans=((ans%m)*(a%m))%m; b/=2; a=((a%m)*(a%m))%m; } return ans%m; }
# define INF (ll)1e18+5LL
# define LG 20
typedef pair<ll,pair<ll,ll> > pii;
# define INF1 1e6+2
# define maxn 100005
# define offset 100005

/*************************************************
struct Coupon {
    ll l;
    ll r;
    ll id;

    Coupon(ll l, ll r, ll id): l(l), r(r), id(id) {} // Initialization

    bool operator<(const Coupon& c) { // Sorting
        return l < c.l;
    }
};

**************************************************/
ll a[maxn];
pair<ll,ll>b[maxn];
ll k;
ll cf[maxn];

ll sum(ll l,ll r)
{
   if((l-1)>=0)
    return cf[r]-cf[l-1];
   return cf[r];
}

int main()
{
  IOS;
  int n;
  cin >> n;
  ll sum1=0;
  for(int i=0;i<n;i++)
    {
       cin >> a[i];
       b[i].ff=a[i];
       b[i].ss=i;
    }
  cin >> k;
  sort(a,a+n);
  sort(b,b+n);

  for(int i=0;i<n;i++)
  {
    sum1+=a[i];
    cf[i]=sum1;
  }
  ll temp=0;
  for(int i=2;i<=k;i++)
  {
     temp=temp+a[i-1]*(i-1)-sum(0,i-2);
  }

 //trace1(temp);
 ll  ans=temp;
 ll  st=0;

  for(int i=1;i<=(n-k);i++)
  {
     temp=temp-(sum(i,i+k-2)-a[i-1]*(k-1))+(a[i+k-1]*(k-1)-sum(i,i+k-2));
     //trace3(i,i+k-2,sum(i,i+k-2));
     //trace2(i,temp);
     if(temp<ans)
     {
       ans=temp;
       st=i;
     }
  }

  for(int i=st;i<st+k;i++)
  {
     cout << b[i].ss+1<<" ";
  }
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
#define int long long
inline int read(){
    int x = 0, f = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){ if(ch == '-') f = -1; ch = getchar(); }
    while(ch >= '0' && ch <= '9'){ x = x * 10 + (ch ^ 48); ch = getchar(); }
    return x * f;
}
struct node{
	int x, idx;
	bool operator < (const node&rhs)const{
		return x < rhs.x;
	}
}a[300010];
int n, k, ans = 0x7f7f7f7f7f7f7f7f, cnt, idx, s[300010];
signed main(){
	n = read();
	for(int i = 1; i <= n; ++i) a[i].x = read(), a[i].idx = i;
	k = read();
	sort(a + 1, a + n + 1);
	for(int i = 1; i <= n; ++i) s[i] = s[i - 1] + a[i].x;
	for(int i = 1; i <= k; ++i) cnt += (i - 1) * a[i].x - s[i - 1]; ans = cnt; idx = 1;
	for(int i = 2; i + k - 1 <= n; ++i){
		cnt -= s[i + k - 2] - s[i - 1] - a[i - 1].x * (k - 1);
		cnt += a[i + k - 1].x * (k - 1) - s[i + k - 2] + s[i - 1];
		if(ans > cnt) ans = cnt, idx = i;
	}
	for(int i = idx; i <= idx + k - 1; ++i) printf("%lld ", a[i].idx);
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	vector<pair<ll, int>> arr(n, pair<ll, int>());
	vector<ll> pref(n, (ll)0);
	for(int i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr.begin(), arr.end());
	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = (pref[i - 1] + arr[i].first);
	pair<ll, int> best = {INF, -1};
	ll ans = 0;
	for(ll i = 1; i < n; ++i) {
		if (i < k) {
			ans += ((i * arr[i].first) - pref[i - 1]);
		} else {
			best = min(best, {ans, i - k});
			ans -= (pref[i - 1] - pref[i - k] - ((k - 1) * arr[i - k].first));
			ans += (((k - 1) * arr[i].first) - pref[i - 1] + pref[i - k]);
		}
	}
	best = min(best, {ans, n - k});
	for(int i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	for(int i = 1; i < k; ++i)
		ans += ((i * arr[i].first) - pref[i - 1]);

	pair<ll, ll> best = {ans, 0};
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		if (ans < best.first) best = {ans, l + 1};
	}

	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	for(int i = 1; i < k; ++i)
		ans += ((i * arr[i].first) - pref[i - 1]);

	pair<ll, ll> best = {ans, 0};
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		if (ans < best.first) best = {ans, l + 1};
	}
	assert(best.second >= 0 and best.second < n - k + 1);
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	for(int i = 1; i < k; ++i)
		ans += ((i * arr[i].first) - pref[i - 1]);

	pair<ll, ll> best = {ans, 0};
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		best = min(best, {ans, l+1});
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	vector<pair<ll, int>> arr(n, pair<ll, int>());
	vector<ll> diff(n, 0);
	for(int i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	sort(arr.begin(), arr.end());
	cin >> k;
	for(int i = 1; i < n; ++i)
		diff[i] = ((k - 1) * (arr[i].first - arr[i - 1].first));
	pair<ll, int> best = {INF, -1};
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		if (i < k) {
			ans += diff[i];
		} else {
			best = min(best, {ans, i - k});
			ans += diff[i];
			ans -= diff[i - k + 1];
		}
	}
	best = min(best, {ans, n - k});
	for(int i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	pair<ll,ll> best = make_pair(INF, INF);
	for(int i = 1; i < k; ++i) {
		ans += ((i * arr[i].first) - pref[i - 1]);
	}
	best = min(best, make_pair(ans, (ll)0));
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		best = min(best, make_pair(ans, l+1));
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);
	pref[0] = arr[0].first;
	for(ll i = 1; i < n; ++i)
		pref[i] = (pref[i - 1] + arr[i].first);
	pair<ll, ll> best = {INF, INF};

	ll ans = 0;
	for(int i = 1; i < k; ++i)
		ans += ((ll)i * arr[i].first) - pref[i - 1];
	best = min(best, {ans, 0});
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		best = min(best, {ans, l + 1});
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	vector<pair<ll, int>> arr(n, pair<ll, int>());
	vector<ll> pref(n, 0);
	for(int i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr.begin(), arr.end());
	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = (pref[i - 1] + arr[i].first);
	pair<ll, int> best = {INF, -1};
	ll ans = 0;
	for(int i = 1; i < n; ++i) {
		if (i < k) {
			ans += ((i * arr[i].first) - pref[i - 1]);
		} else {
			best = min(best, {ans, i - k});
			ans -= (pref[i - 1] - pref[i - k] - ((k - 1) * arr[i - k].first));
			ans += (((k - 1) * arr[i].first) - pref[i - 1] + pref[i - k]);
		}
	}
	best = min(best, {ans, n - k});
	for(int i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	pair<ll, ll> best = {INF, INF};
	for(int i = 1; i < k; ++i)
		ans += ((i * arr[i].first) - pref[i - 1]);
	best = min(best, {ans, 0});
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		best = min(best, {ans, l+1});
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	vector<pair<ll, ll>> arr(n, pair<ll, ll>());
	vector<ll> pref(n, (ll)0);
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr.begin(), arr.end());
	pref[0] = arr[0].first;
	for(ll i = 1; i < n; ++i)
		pref[i] = (pref[i - 1] + arr[i].first);
	pair<ll, ll> best = {INF, INF};
	ll ans = 0;
	for(ll i = 1; i < n; ++i) {
		if (i < k) {
			ans += ((i * arr[i].first) - pref[i - 1]);
		} else {
			best = min(best, {ans, i - k});
			ans -= (pref[i - 1] - pref[i - k] - ((k - 1) * arr[i - k].first));
			ans += (((k - 1) * arr[i].first) - pref[i - 1] + pref[i - k]);
		}
	}
	best = min(best, {ans, n - k});
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 1e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	vector<pair<ll, ll>> arr(n, pair<ll, ll>());
	vector<ll> pref(n, (ll)0);
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr.begin(), arr.end());
	pref[0] = arr[0].first;
	for(ll i = 1; i < n; ++i)
		pref[i] = (pref[i - 1] + arr[i].first);
	pair<ll, ll> best = {INF, INF};

	ll ans = 0;
	for(int i = 1; i < k; ++i)
		ans += ((ll)i * arr[i].first) - pref[i - 1];
	best = min(best, {ans, 0});
	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		best = min(best, {ans, l + 1});
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	pair<ll,ll> best = make_pair(INF, INF);
	for(int i = 1; i < k; ++i) {
		ans += ((i * arr[i].first) - pref[i - 1]);
	}
	if (ans < best.first)
		best = {ans, 0LL};

	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		if (ans < best.first)
			best = {ans, l + 1};
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


/**
*	author: Shaurya Bagga
**/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef long double ld;

#define int ll
#define endl "\n"

const ll MOD = 1e9 + 7;
const ll MAX = 3e5 + 10;
const double PI = 3.1415926;
const ll INF = 1e18;
const double EPS = 1e-5;

pair<ll,ll> arr[MAX];
ll pref[MAX];

signed main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	ll n, k; cin >> n;
	for(ll i = 0; i < n; ++i) {
		cin >> arr[i].first;
		arr[i].second = i + 1;
	}
	cin >> k;
	sort(arr, arr + n);

	pref[0] = arr[0].first;
	for(int i = 1; i < n; ++i)
		pref[i] = pref[i - 1] + arr[i].first;

	ll ans = 0;

	for(int i = 1; i < k; ++i) {
		ans += ((i * arr[i].first) - pref[i - 1]);
	}
	pair<ll,ll> best = make_pair(ans, 0LL);

	for(ll l = 0, r = k; r < n; ++l, ++r) {
		ll temp = pref[r - 1] - pref[l] - (k - 1)*arr[l].first;
		ans -= temp;
		temp = -pref[r - 1] + pref[l] + (k - 1)*arr[r].first;
		ans += temp;
		if (ans < best.first)
			best = {ans, l + 1};
	}
	for(ll i = best.second; i < k + best.second; ++i)
		cout << arr[i].second << " ";
	cout << endl;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <math.h>
#include <functional>
#include <numeric>
#include <chrono>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);

using namespace std;

const ll inf = 1e17;
const int N = 3e5+10;
const ll mod = 998244353;
const int bits = 20;
const ld pi = 3.14159265358979323846;

void solve(){
    int n, k;
    cin>>n;
    vector<ll>arr(n+1),psum(n+1),psq(n+1);
    map<ll,ll>mp;

    for(int i=1;i<=n;i++){
        cin>>arr[i];
        mp[arr[i]] = i;
    }

    cin>>k;

    ll sum = 0,csum = 0;

    sort(arr.begin()+1,arr.end());

    for(int i=1;i<=k;i++){
        sum+=-arr[i]*(k-i)+arr[i]*(i-1);
        csum+=arr[i];
    }

    ll ans = sum, pos = 1;

    for(int i=k+1;i<=n;i++){
        sum -= -arr[i-k]*(k-1);
        sum += arr[i]*(k-1);
        csum -= arr[i-k];
        sum += -2*csum;
        csum += arr[i];

        if(sum<ans){
            pos = i-k+1;
        }
    }

    for(int i=0;i<k;i++){
        cout<<mp[arr[i+pos]]<<" ";
    }
    cout<<"\n";

}

int main(){

    FASTIO;
    PRECISION;

    ll t = 1;
    // cin>>t;

    while(t--){
        solve();
    }
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <math.h>
#include <functional>
#include <numeric>
#include <chrono>

typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(20);

using namespace std;

const ll inf = 1e17;
const int N = 3e5+10;
const ll mod = 998244353;
const int bits = 20;
const ld pi = 3.14159265358979323846;

void solve(){
    int n, k;
    cin>>n;
    vector<ll>arr(n+1),psum(n+1),psq(n+1);
    map<ll,ll>mp;

    for(int i=1;i<=n;i++){
        cin>>arr[i];
        mp[arr[i]] = i;
    }

    cin>>k;

    ll sum = 0,csum = 0;

    sort(arr.begin()+1,arr.end());

    for(int i=1;i<=k;i++){
        sum+=-arr[i]*(k-i)+arr[i]*(i-1);
        csum+=arr[i];
    }

    ll ans = sum, pos = 1;

    for(int i=k+1;i<=n;i++){
        sum -= -arr[i-k]*(k-1);
        sum += arr[i]*(k-1);
        csum -= arr[i-k];
        sum += -2*csum;
        csum += arr[i];

        if(sum<ans){
            pos = i-k+1;
            ans = sum;
        }
    }

    for(int i=0;i<k;i++){
        cout<<mp[arr[i+pos]]<<" ";
    }
    cout<<"\n";

}

int main(){

    FASTIO;
    PRECISION;

    ll t = 1;
    // cin>>t;

    while(t--){
        solve();
    }
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <system_error>

using namespace std;

struct Station
{
	long long coord;
	int number;
};

bool Comp(Station a, Station b)
{
	return a.coord < b.coord;
}

int main()

{
	ios_base::sync_with_stdio(false);
	long long n, k;
	cin >> n;
	vector<Station> stations(n);
	for (int i = 0; i < n; i++)
	{
		cin >> stations[i].coord;
		stations[i].number = i + 1;
	}
	cin >> k;
	sort(stations.begin(), stations.end(), Comp);
	vector<long long> dp(k);
	dp[0] = 0;
	dp[1] = stations[1].coord - stations[0].coord;
	for (int i = 2; i < k; i++)
	{
		dp[i] = dp[i - 1] + i * (stations[i].coord - stations[i - 1].coord) + dp[i - 1] - dp[i - 2];
	}
	long long answer = dp[k - 1];
	long long posStart = 0;
	long long fromLeftLast = 0;
	for (int i = 1; i < k; i++)
	{
		fromLeftLast += stations[i].coord - stations[0].coord;
	}
	long long fromRightLast = 0;
	for (int i = 0; i < k - 1; i++)
	{
		fromRightLast += stations[k - 1].coord - stations[i].coord;
	}
	long long step = dp[k - 1];
	for (int i = 1; i < n - k + 1; i++)
	{
		step += k * (stations[k - 1 + i].coord - stations[k - 2 + i].coord) + fromRightLast;
		step -= fromLeftLast + (stations[k - 1 + i].coord - stations[i - 1].coord);
		if (step < answer)
		{
			answer = step;
			posStart = i;
		}
		fromLeftLast = fromLeftLast + (stations[k - 1 + i].coord - stations[i].coord) - (k - 1) * (stations[i].coord - stations[i - 1].coord);
		fromRightLast = fromRightLast + (k - 1) * (stations[k - 1 + i].coord - stations[k - 2 + i].coord) - (stations[k - 2 + i].coord - stations[i - 1].coord);
	}
    for (int i = posStart; i < posStart + k; i++)
	{
	cout << stations[i].number << " ";
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Station
{
    int coord;
    int number;
};

bool Comp(Station a, Station b)
{
    return a.coord < b.coord;
}

int main()

{
    ios_base::sync_with_stdio(false);
    int n, k;
    cin >> n;
    vector<Station> stations(n);
    for (int i = 0; i < n; i++)
    {
        cin >> stations[i].coord;
        stations[i].number = i + 1;
    }
    cin >> k;
    sort(stations.begin(), stations.end(), Comp);
    vector<long long> dp(k);
    dp[0] = 0;
    dp[1] = stations[1].coord - stations[0].coord;
    for (int i = 2; i < k; i++)
    {
        dp[i] = i * (stations[n - i].coord - stations[n - i - 1].coord) + dp[i - 1] - dp[i - 2];
    }
    long long answer = dp[k - 1];
    long long posStart = 0;
    long long fromLeftLast = 0;
    for (int i = 1; i < k; i++)
    {
        fromLeftLast += stations[i].coord - stations[0].coord;
    }
    long long fromRightLast = 0;
    for (int i = 0; i < k - 1; i++)
    {
        fromRightLast += stations[k - 1].coord - stations[i].coord;
    }
    long long bigLast = 0;
    long long step = dp[k - 1];
    for (int i = 1; i < n - k + 1; i++)
    {
        step += k * (stations[k - 1 + i].coord - stations[k - 2 + i].coord) + fromRightLast;
        step -= fromLeftLast + (stations[k - 1 + i].coord - stations[i - 1].coord);
        if (step < answer)
        {
            answer = step;
            posStart = i;
        }
        fromLeftLast = fromLeftLast + (stations[k - 1 + i].coord - stations[i - 1].coord) - (k - 1) * (stations[i].coord - stations[i - 1].coord);
        fromRightLast = fromRightLast + (k - 1) * (stations[k - 1 + i].coord  - stations[k - 2 + i].coord) - (stations[k - 2 + i].coord - stations[i - 1].coord);
    }
    for (int i = posStart; i < posStart + k; i++)
    {
        cout << stations[i].number << " ";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <system_error>

using namespace std;

struct Station
{
	int coord;
	int number;
};

bool Comp(Station a, Station b)
{
	return a.coord < b.coord;
}

int main()

{
	ios_base::sync_with_stdio(false);
	int n, k;
	cin >> n;
	vector<Station> stations(n);
	for (int i = 0; i < n; i++)
	{
		cin >> stations[i].coord;
		stations[i].number = i + 1;
	}
	cin >> k;
	sort(stations.begin(), stations.end(), Comp);
	vector<long long> dp(k);
	dp[0] = 0;
	dp[1] = stations[1].coord - stations[0].coord;
	for (int i = 2; i < k; i++)
	{
		dp[i] = dp[i - 1] + i * (stations[i].coord - stations[i - 1].coord) + dp[i - 1] - dp[i - 2];
	}
	long long answer = dp[k - 1];
	long long posStart = 0;
	long long fromLeftLast = 0;
	for (int i = 1; i < k; i++)
	{
		fromLeftLast += stations[i].coord - stations[0].coord;
	}
	long long fromRightLast = 0;
	for (int i = 0; i < k - 1; i++)
	{
		fromRightLast += stations[k - 1].coord - stations[i].coord;
	}
	long long step = dp[k - 1];
	for (int i = 1; i < n - k + 1; i++)
	{
		step += k * (stations[k - 1 + i].coord - stations[k - 2 + i].coord) + fromRightLast;
		step -= fromLeftLast + (stations[k - 1 + i].coord - stations[i - 1].coord);
		if (step < answer)
		{
			answer = step;
			posStart = i;
		}
		fromLeftLast = fromLeftLast + (stations[k - 1 + i].coord - stations[i].coord) - (k - 1) * (stations[i].coord - stations[i - 1].coord);
		fromRightLast = fromRightLast + (k - 1) * (stations[k - 1 + i].coord - stations[k - 2 + i].coord) - (stations[k - 2 + i].coord - stations[i - 1].coord);
	}
    for (int i = posStart; i < posStart + k; i++)
	{
	cout << stations[i].number << " ";
	}
	return 0;
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define endl '\n'
void fast_io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
ll gcd(ll a , ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	fast_io();
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// init();
	int t = 1;
	// cin >> t;
	while (t--)
	{
		int n; cin >> n;

		vpii a;
		a.pb(make_pair(0, 0));
		for (int i = 1; i <= n; i++) {
			int j ; cin >> j;
			a.pb(make_pair(j, i));
		}
		int k; cin >> k;
		sort(a.begin(), a.end());
		// for (int i = 1; i <= n; i++) {
		// 	cout << a[i].ff << " " << a[i].ss << endl;
		// }
		int l = 1, r = 2;
		ll sum = 0;
		ll cum[n + 1];
		cum[0] = 0;
		for (int i = 1; i <= n; i++) {
			cum[i] = cum[i - 1] + a[i].ff;
		}
		while (r <= k) {
			sum += (a[r].ff * (r - l) - (cum[r - 1] - cum[l - 1]));
			r++;
		}
		ll minsum = sum;
		int st = l, en = r - 1;
		while (r <= n) {
			sum -= (cum[r - 1] - cum[l] - a[l].ff * (r - 1 - l));
			l++;
			sum += (a[r].ff * (r - l) - (cum[r - 1] - cum[l - 1]));
			if (sum < minsum) {
				minsum = sum;
				st = l;
				en = r;
			}
			r++;
		}
		// if (r > n) r--;
		for (int i = st; i <= en; i++) {
			cout << a[i].ss << " ";
		}
		cout << endl;

	}

}


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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define endl '\n'
void fast_io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
ll gcd(ll a , ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	fast_io();
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// init();
	int t = 1;
	// cin >> t;
	while (t--)
	{
		int n; cin >> n;

		vpii a;
		for (int i = 0; i < n; i++) {
			int j ; cin >> j;
			a.pb(make_pair(j, i));
		}
		int k; cin >> k;
		sort(a.begin(), a.end());
		// for (int i = 1; i <= n; i++) {
		// 	cout << a[i].ff << " " << a[i].ss << endl;
		// }
		int l = 0, r = 1;
		unsigned long long sum = 0;
		ll cum[n + 1];
		cum[0] = a[0].ff;
		for (int i = 1; i < n; i++) {
			cum[i] = cum[i - 1] + a[i].ff;
		}
		while (r < k) {
			sum += (a[r].ff * (r - l) - (cum[r - 1] - cum[l - 1]));
			r++;
		}
		unsigned long long minsum = sum;
		int st = l, en = r - 1;
		while (r < n) {
			sum -= (cum[r - 1] - cum[l] - a[l].ff * (r - 1 - l));
			l++;
			sum += (a[r].ff * (r - l) - (cum[r - 1] - cum[l - 1]));
			if (sum < minsum) {
				minsum = sum;
				st = l;
				en = r;
			}
			r++;
		}
		// if (r > n) r--;
		// cout << st << " " << en << endl;
		for (int i = st; i <= en; i++) {
			cout << a[i].ss + 1 << " ";
		}
		cout << endl;

	}

}


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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define endl '\n'
void fast_io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
ll gcd(ll a , ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	fast_io();
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// init();
	int t = 1;
	// cin >> t;
	while (t--)
	{
		int n; cin >> n;

		vpii a;
		for (int i = 0; i < n; i++) {
			int j ; cin >> j;
			a.pb(make_pair(j, i));
		}
		int k; cin >> k;
		sort(a.begin(), a.end());
		// for (int i = 1; i <= n; i++) {
		// 	cout << a[i].ff << " " << a[i].ss << endl;
		// }
		int l = 0, r = 1;
		ll sum = 0;
		ll cum[n + 1];
		cum[0] = a[0].ff;
		for (int i = 1; i < n; i++) {
			cum[i] = cum[i - 1] + a[i].ff;
		}
		while (r < k) {
			sum += (a[r].ff * (r - l) - (cum[r - 1] - cum[l - 1]));
			r++;
		}
		ll minsum = sum;
		int st = l, en = r - 1;
		while (r < n) {
			sum -= (cum[r - 1] - cum[l] - a[l].ff * (r - 1 - l));
			l++;
			sum += (a[r].ff * (r - l) - (cum[r - 1] - cum[l - 1]));
			if (sum < minsum) {
				minsum = sum;
				st = l;
				en = r;
			}
			r++;
		}
		// if (r > n) r--;
		// cout << st << " " << en << endl;
		for (int i = st; i <= en; i++) {
			cout << a[i].ss + 1 << " ";
		}
		cout << endl;

	}

}


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

typedef long long ll;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define endl '\n'
void fast_io()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}
ll gcd(ll a , ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

int main()
{
	fast_io();
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// init();
	int t = 1;
	// cin >> t;
	while (t--)
	{
		int n; cin >> n;

		vll a(n + 1);
		map<int , int> ind;
		for (int i = 1; i <= n; i++) {
			cin >> a[i];
			ind[a[i]] = i;
		}

		int k; cin >> k;

		ll cum[n + 1];
		cum[0] = 0;
		sort(a.begin() + 1, a.end());
		for (int i = 1; i <= n; i++ ) {
			cum[i] = cum[i - 1] + a[i];
		}
		int l = 1, r = 2;
		ll sum = 0;
		while (r <= k) {
			sum += (a[r] * (r - l) - (cum[r - 1] - cum[l - 1]));
			r++;

		}
		int st = l, en = r - 1;

		ll minsum = sum;
		while (r <= n) {
			sum -= (cum[r - 1] - cum[l] - a[l] * (r - 1 - l));
			l++;
			sum += (a[r] * (r - l) - (cum[r - 1] - cum[l - 1]));
			if (sum < minsum) {
				minsum = sum;
				st = l;
				en = r;
			}
			r++;
		}
		for (int i = st; i <= en; i++) {
			cout << ind[a[i]] << " ";
		}
		cout << endl;

	}

}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 3e5+100;
struct node
{
    int x;
    int id;
}a[maxn];
bool cmp(const node a,const node b)
{
    if(a.x==b.x)return a.id<b.id;
    return a.x<b.x;
}
int ans[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0;i<n;i++)
    {
        scanf("%d",&a[i].x);
        a[i].id = i+1;
    }
    sort(a,a+n,cmp);
    int k;
    scanf("%d",&k);
    int maxx = 0x3f3f3f3f;
    int ii;
    for(int i = 0;i<=n-k;i++)
    {
        if(a[i+k-1].x - a[i].x<maxx)
        {
            maxx = a[i+k-1].x - a[i].x;
            ii = i;
        }
    }
    for(int i = 0;i<k;i++ )
    {
        ans[i] = a[ii+i].id;
    }
    sort(ans,ans+k);
    for(int i =0 ;i<k;i++)printf("%d%c",ans[i],i==k-1?'\n':' ');
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define maxn 333333
int n,k;
typedef pair<int,int>P;
P x[maxn];
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)scanf("%d",&x[i].first),x[i].second=i+1;
        scanf("%d",&k);
        sort(x,x+n);
        ll sum1=0,sum2=0,ans=0;
        for(int i=0;i<k;i++)sum1+=x[i].first;
        int pos=0;
        for(int i=k;i<n;i++)
        {
            sum2+=1ll*(k-1)*(x[i].first+x[i-k].first)-2ll*(sum1-x[i-k].first);
            sum1+=x[i].first-x[i-k].first;
            if(sum2<ans)ans=sum2,pos=i-k+1;
        }
        for(int i=0;i<k;i++)printf("%d%c",x[pos+i].second,i==k-1?'\n':' ');
    }
    return 0;
}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 3e5+100;
struct node
{
    int x;
    int id;
}a[maxn];
bool cmp(const node a,const node b)
{
    return a.x<b.x;
}
int ans[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0;i<n;i++)
    {
        scanf("%d",&a[i].x);
        a[i].id = i+1;
    }
    sort(a,a+n,cmp);
    int k;
    scanf("%d",&k);
    int maxx = 0x3f3f3f3f;
    int ii;
    for(int i = 0;i<=n-k;i++)
    {
        if(a[i+k-1].x - a[i].x<maxx)
        {
            maxx = a[i+k].x - a[i].x;
            ii = i;
        }
    }
    for(int i = 0;i<k;i++ )
    {
        ans[i] = a[ii+i].id;
    }
    sort(ans,ans+k);
    for(int i =0 ;i<k;i++)printf("%d%c",ans[i],i==k-1?'\n':' ');
}


#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn = 3e5+100;
struct node
{
    int x;
    int id;
}a[maxn];
bool cmp(const node a,const node b)
{
    return a.x<b.x;
}
int ans[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0;i<n;i++)
    {
        scanf("%d",&a[i].x);
        a[i].id = i+1;
    }
    sort(a,a+n,cmp);
    int k;
    scanf("%d",&k);
    int l = 0,r = 0;
    int maxx = 0x3f3f3f3f;
    int ii;
    for(int i = 0;i<n-k;i++)
    {
        if(a[i+k].x - a[i].x<maxx)
        {
            maxx = a[i+k].x - a[i].x;
            ii = i;
        }
    }
    for(int i = 0;i<k;i++ )
    {
        ans[i] = a[ii+i].id;
    }
    sort(ans,ans+k);
    for(int i =0 ;i<k;i++)printf("%d%c",ans[i],i==k-1?'\n':' ');
}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<int> v1(n), two(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin>>k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i+1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			if (end - start > 0)
				sum += (v1[end]-v1[end - 1]);
			end++;
		}
		if (sum < mn) {
			mn = sum;
			s1 = start;
			s2 = end;
		}
		sum += (v1[start] - v1[start + 1]);
		start++;
	}

	for(int i = s1;i<s2;i++){
		cout<<idx[v1[i]]<<" ";
	}
	cout<<endl;
	return 0;

}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<ll> v1(n), two(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin>>k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i+1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			if (end - start > 0)
				sum += abs(v1[end]-v1[end - 1]);
			end++;
		}
		if (sum < mn) {
			mn = sum;
			s1 = start;
			s2 = end;
		}
		sum -= abs(v1[start] - v1[start + 1]);
		start++;
	}
	set<int>show;
	for(int i = s1;i<s2;i++){
		show.insert(idx[v1[i]]);
	}
	for(auto it:show)
		cout<<it<<" ";
	cout<<endl;
	return 0;

}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<ll> v1(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin >> k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i + 1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX, pre = 0;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			sum += abs((end - start) * (v1[end]) - pre);
			pre+=v1[end];
			end++;
		}
		if(sum<=mn){
			mn = sum;
			s1 = start;
			s2 = end;
		}
		pre-=v1[start];
		sum-=abs((end-start-1)*v1[start]-pre);
		start++;
	}

	for(int i = s1;i<s2;i++)
		cout<<idx[v1[i]]<<" ";
	cout<<endl;
	return 0;

}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<int> v1(n), two(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin>>k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i+1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			if (end - start > 0)
				sum += abs(v1[end]-v1[end - 1]);
			end++;
		}
		if (sum < mn) {
			mn = sum;
			s1 = start;
			s2 = end;
		}
		sum -= abs(v1[start] - v1[start + 1]);
		start++;
	}
	set<int>show;
	for(int i = s1;i<s2;i++){
		show.insert(idx[v1[i]]);
	}
	for(auto it:show)
		cout<<it<<" ";
	cout<<endl;
	return 0;

}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<ll> v1(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin>>k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i+1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			if (end - start > 0)
				sum += abs(v1[end]-v1[end - 1]);
			end++;
		}
		if (sum <= mn) {
			mn = sum;
			s1 = start;
			s2 = end;
		}
		sum -= abs(v1[start] - v1[start + 1]);
		start++;
	}
	set<int>show;
	for(int i = s1;i<s2;i++){
		show.insert(idx[v1[i]]);
	}
	for(auto it:show)
		cout<<it<<" ";
	cout<<endl;
	return 0;

}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<ll> v1(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin>>k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i+1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			if (end - start > 1)
				sum += abs(v1[end]-v1[end - 1]);
			end++;
		}
		if (sum < mn) {
			mn = sum;
			s1 = start;
			s2 = end;
		}
		sum -= abs(v1[start] - v1[start + 1]);
		start++;
	}
	set<int>show;
	for(int i = s1;i<s2;i++){
		show.insert(idx[v1[i]]);
	}
	for(auto it:show)
		cout<<it<<" ";
	cout<<endl;
	return 0;

}


#include<bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
#define all(v) v.begin(),v.end()
#define allr(s) s.rbegin(),s.rend()
#define RT(s) return cout<<s,0
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define sz(s)	(int)(s.size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
void file() {
#ifndef ONLINE_JUDGE
	freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
#endif
}
void fast() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
}

int main() {
	file();
	fast();
	int n, k;
	cin >> n;
	vector<int> v1(n), two(n);
	for (int i = 0; i < n; i++)
		cin >> v1[i];
	cin>>k;
	map<int, int> idx;
	for (int i = 0; i < n; i++)
		idx[v1[i]] = i+1;
	sort(all(v1));
	int start = 0, end = 0, s1, s2;
	ll sum = 0, mn = LLONG_MAX;
	while (start <= n - k) {
		while (end - start < k && end < n) {
			if (end - start > 0)
				sum += (v1[end]-v1[end - 1]);
			end++;
		}
		if (sum < mn) {
			mn = sum;
			s1 = start;
			s2 = end;
		}
		sum += (v1[start] - v1[start + 1]);
		start++;
	}
	set<int>show;
	for(int i = s1;i<s2;i++){
		show.insert(idx[v1[i]]);
	}
	for(auto it:show)
		cout<<it<<" ";
	cout<<endl;
	return 0;

}