jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {

	private final static long MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String keyence = "keyence";

		for (int i = 0; i < keyence.length(); i++) {
			if (S.startsWith(keyence.substring(0, i))) {
				if (S.endsWith(keyence.substring(i))) {
					System.out.println("YES");
					return;
				}
			}
		}

		System.out.println("NO");
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;
		private StringBuilder buffer = new StringBuilder();

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			int read = skip();
			do {
				buffer.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			String text = buffer.toString();
			buffer.delete(0, buffer.length());

			return text;
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}
//  [java]
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
		//Implement solution here.
		String s = next();
		String k = "keyence";
		if(s.startsWith(k) || s.endsWith(k)) {
			System.out.println("YES");
			return;
		} else {
			char[] kc = k.toCharArray();
			for(int i = 1; i <= kc.length; i++) {
				String l = k.substring(0,i);
				String r = k.substring(i,kc.length);
				if(s.startsWith(l) && s.endsWith(r)) {
					System.out.println("YES");
					return;
				}
			}
		}
		System.out.println("NO");
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		solve();
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}
//  [java]
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int upper_division(int a,int b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lupper_division(long a,long b) {
		if(a%b==0) {
			return a/b;
		}
		else {
			return a/b+1;
		}
	}
	static long lmax(long a,long b) {return Math.max(a, b);}
	static long lmin(long a,long b) {return Math.min(a, b);}
	static int[] setArray(int a) {
		int b[]=new int[a];
		for(int i=0;i<a;i++) {
			b[i]=scan.nextInt();
		}
		return b;
	}
	static String reverce(String str) {
		String strr="";
		for(int i=str.length()-1;i>=0;i--) {
			strr+=str.charAt(i);
		}
		return strr;
	}
	public static void main(String[]args){
		String a=scan.next();
		boolean bool=false;
		if(a.charAt(0)!='k'||a.charAt(a.length()-1)!='e') {
			if(a.indexOf("keyence")!=-1) {
				System.out.println("YES");
			}
			else {
				System.out.println("NO");
			}
			return;
		}
		
		for(int i=0;i<a.length();i++) {//一つ目の最初の場所
			for(int j=i+1;j<=a.length();j++) {//一つ目の最後
				String str1=a.substring(i,j);
				for(int k=j;k<a.length();k++) {
					for(int l=k+1;l<=a.length();l++)	{
						String str2=a.substring(k,l);
						String str=str1+str2;
						if(str.equals("keyence"))bool=true;
					}
				}
			}
		}
		System.out.println(bool?"YES":"NO");
	}
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        char[] c = str.toCharArray();
        int n = c.length;
        
        String ans = "NO";
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                String now = "";
                for (int k = 0; k < i; k++) {
                    now += c[k];
                }
                for (int k = j; k < n; k++) {
                    now += c[k];
                }
                // System.out.println(now);
                if (now.equals("keyence")) {
                    ans = "YES";
                    break;
                }
            }
        }
        System.out.println(ans);
    }
}
//  [cpp]
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
char s[1010],t[1010];
const char st[8]={0,'k','e','y','e','n','c','e'};
bool cmp(char s[]) {
	for (int i=1;i<=7;i++) if (s[i]!=st[i]) return 0;
	return 1;
}
int main() {
	gets(s+1); n=strlen(s+1);
	if (n==7&&cmp(s)) {
		puts("YES"); return 0;
	} 
	for (int i=1;i<=8;i++) {
		for (int j=1;j<i;j++) t[j]=s[j];
		for (int j=7;j>=i;j--) t[j]=s[n-7+j];
		//for (int j=1;j<=7;j++) putchar(t[j]); puts("");
		if (cmp(t)) {
			puts("YES"); return 0;
		}
	}
	puts("NO");
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define pb push_back
#define fi first
#define se second


int main(){
    ll i,j;
    string s;
    cin>>s;
    ll l=s.size();

    string aa="keyence";

    ll f=1;
    ll mae=0;
    ll usiro=0;

    for(i=0;i<7;i++){
        if(s[i]==aa[i]&&f==1) mae++;
        else f=0;
    }
    f=1;
    for(i=0;i<7;i++){
        if(s[l-1-i]==aa[7-1-i]&&f==1) usiro++;
        else f=0;
    }

    string ans="NO";
    if(mae+usiro>=7) ans="YES";
    cout<<ans<<endl;
    return 0;
    
}
//  [cpp]
#include <iostream>
#include <string>

bool check(const std::string& s)
{
  const std::string KEYENCE = "keyence";

  for (int i = 0; i < KEYENCE.length(); ++i) {
    if (s[i] != KEYENCE[i]) {
      return s.substr(s.length() - KEYENCE.length() + i) == KEYENCE.substr(i);
    }
  }
  return true;
}

int main(int argc, char* argv[])
{
  std::string s;
  std::cin >> s;

  if (check(s)) {
      std::cout << "YES";
  }
  else {
      std::cout << "NO";
  }

  return 0;
}
//  [cpp]
//
//  main.cpp
//  190113
//

#include <iostream>
#include <regex>

std::string parts(std::string s,int sta,int fin){
    std::string ret="";
    for(int i=sta;i<fin;i++){
        ret+=s[i];
    }
    return ret;
}

int main(int argc, const char * argv[]) {
    // insert code here...
//    //std::string str[3] = {"int", "double[4]", "char[32]"}; // 対象文字列
//    std::string str[3] = {"inta", "Uint", "inxt"}; // 対象文字列
//    //std::regex re("(int|double|char)(\\[(\\d+)\\])?"); // 正規表現
//    std::string reStr=R"((^in))";
//    std::cout<<reStr;
//    //std::regex re(R"((^in))");
//    std::regex re(reStr);
//    std::smatch match; // string型の文字列に対するマッチング結果を格納するのがstd::smatch型
//
//    for( int i = 0; i < 3; ++i ){
//        if(regex_search(str[i], match, re)){ // regex_match()は正規表現にマッチすると1を返す
//            std::cout << "matched: " ;
//            for ( int j = 0; j < match.size(); ++j ){ // match.size()はサブグループの数+1を返す
//                std::cout << match[j] << ":";
//            }
//            std::cout << std::endl;
//        }
//    }
    
    std::string a="keyence";

    
    std::string S;
    std::cin>>S;
    
    //std::cout<<S<<std::endl;
    
    bool isYes=false;
    std::smatch match;
    
    std::string wilds="";
    for(int i=0;i<S.size()-a.size();i++){
        wilds+="\\w";
    }
    
    for(int i=0;i<7+1;i++){
        for(int j=0;j<i;j++){
            std::string reStr="(";
            reStr+=parts(a, 0, j);
            reStr+=wilds;
            reStr+=parts(a, j, 7);
            reStr+=")";
            std::regex re(reStr);
            
            //std::cout<<reStr<<std::endl;
            if(regex_match(S, match, re)){
                isYes=true;
            }
        }
    }
    
    if(isYes){
        std::cout<<"YES\n";
    }else{
        std::cout<<"NO\n";
    }
    
    return 0;
}
//  [cpp]
#include<iostream>
#include<stdio.h>

using namespace std;

string s;
int main(){
    cin >> s;
    int l = s.size();
    for(int i=0; i<l; i++) {
        for(int j=i; j<l; j++) {
            for(int k=i; k<l; k++) {
                if( s.substr(i,j) + s.substr(k) == "keyence" ) {
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

long int combination(long int n, long int r);

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(data, 10, sizeof(int), compare_int)

long int combination(long int n, long int r)
{
	if(r>n-r) r = n-r;
	if(r == 0) return 1;
	else if(r == 1) return n;
	return (combination(n-1, r) + combination(n-1, r-1));
	//大きくなるとき
	/*
	long int tmp1, tmp2, tmp3;
	tmp1 = combination(n-1, r);
	if(tmp1>=MOD) tmp1 = tmp1%MOD;
	tmp2 = combination(n-1, r-1);
	if(tmp2>=MOD) tmp2 = tmp2%MOD;
	tmp3 = tmp1+tmp2;
	if(tmp3>=MOD) tmp3 = tmp3%MOD;
	return (tmp3);
	*/
}


int main(){
	char str[101];
	char key[] = "keyence";
	scanf("%s", str);
	int len = strlen(str);

	int ok=0, count, k;
	for(int i=0; i<7; i++){
		count=0, k=0;
		for(int j=0; j<i; j++){
			if(str[j] == key[k]){
				count++;
			}
			k++;
		}
		if(count!=i) continue;
		for(int j=i+len-7; j<len; j++){
			if(str[j] == key[k]){
				count++;
			}
			k++;
		}
		if(count == 7){
			ok=1;
			break;
		}
	}
	if(ok==1) printf("YES\n");
	else printf("NO\n");
		
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main(void) {

  char s[101];
  scanf("%s", s);
  char keyence[8] = "keyence";
  int length = strlen(s);
  int current = 0;
  for (int i = 0; i < length; i++) {
    if (s[i] != keyence[current]) {
      break;
    } else {
      current++;
      if (current == 7) {
        break;
      }
    }
  }
  int flag = 1;
  int start = length-1-(6-current);
  for (int i = start; i < length; i++) {
    if (s[i] != keyence[current]) {
      flag = 0;
      break;
    } else {
      current++;
    }
  }
  if (flag == 1) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }

  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
int main() {
	char s[101], key[8] = "keyence";
	scanf("%s", s);
	int cnt = 0, len = strlen(s);
	for (int i = 0; i <= 7; i++) {
		if (s[i] != key[i]) {
			cnt = 7 - i;
			break;
		}
	}
	for (int i = 0; i < cnt; i++) {
		if (s[len - i - 1] != key[6 - i]) {
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main(){
    char s[105]; scanf("%s",s);
    char c[10] = {"keyence"};
    int n = strlen(s);
    int m = strlen(c);
    rep(i,m+1){
        char tc[10]={0};
        strncpy(tc,s,i);
        strncpy(tc+i,s+i+(n-m),m-i);
        if(strcmp(tc,c)==0){
            puts("YES");
            return 0;
        }
    }

    puts("NO");
}
//  [c]
#include<stdio.h>
#include<string.h>

int main(void)
{
  char s[128];

  scanf("%s",s);
  if(strcmp("keyence",s)==0){
    puts("YES");
    return 0;
  }

  int len=strlen(s);

  for(int i=0;i<len;i++){
    for(int j=i;j<len;j++){
      char tmp[128]="\0";
      int st=0;
      for(int k=0;k<len;k++){
        if(i>k||k>j){
          tmp[st]=s[k];
          st++;
        }
      }
      // printf("%s\n",tmp);
      if(strcmp(tmp,"keyence")==0){
        puts("YES");
        return 0;
      }
    }
  }
  puts("NO");

  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
int main(void){
    char s[100+5];
    scanf("%s", s);
    int n=strlen(s);
    
    char target[]="keyence";
    
    if(strcmp(s, target)==0){
        printf("YES\n");
        return 0;
    }
    
    for(int i=0; i<n; i++){
        for(int j=i; j<n; j++){
            // s[i~j]を消す
            char str[100+5]={};
            int p=0;
            for(int k=0; k<n; k++){
                if(!(i<=k && k<=j)){
                    str[p]=s[k];
                    p++;
                }
            }
            // printf("%s\n", str);
            if(strcmp(str, target)==0){
                printf("YES\n");
                return 0;
            }
        }
    }
    printf("NO\n");
}
//  [javascript]

function Main(arg)
{
  var N = arg.split("\n")[0]+"";

  if (N.startsWith("keyence") || N.endsWith("keyence")) {
    console.log("YES");
    return;
  }
  else {
    for (var i = 1; i <= 7; i++){
      if (N.startsWith("keyence".slice(0, i)) && N.endsWith("keyence".slice(i))) {
        console.log("YES");
    	return;
      }
    }
  }

  console.log("NO");
  return;
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
    var flag = false;
    if(input.substr(0,7)=="keyence"||input.substr(-7)=="keyence"){
        flag = true;
    }else{
        	input = input.split("");
        	var p=0
    if(input[0]=="k"){
        p=1;
        if(input[1]=="e"){
            p=2;
            if(input[2]=="y"){
                p=3;
                if(input[3]=="e"){
                    p=4;
                    if(input[4]=="n"){
                        p=5;
                        if(input[5]=="c"){
                            p=6;
                        }
                    }
                }
            }
        }
    }
    var n = 0
        if(input[input.length-1]=="e"){
        n=1;
        if(input[input.length-1-1]=="c"){
            n=2;
            if(input[input.length-1-2]=="n"){
                n=3;
                if(input[input.length-1-3]=="e"){
                    n=4;
                    if(input[input.length-1-4]=="y"){
                        n=5;
                        if(input[input.length-1-5]=="e"){
                            n=6;
                        }
                    }
                }
            }
        }
    }
    }
        console.log((flag||p+n>=7)?"YES":"NO")
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split("");
	inputWord = input[0];
	// keyence
	const targetList = ['k', 'e', 'y', 'e','n', 'c', 'e']
	var pattern = 'keyence';	

	if(inputWord.indexOf(pattern) === 0) {
		console.log('YES');
		return;
	}
	if((inputWord.lastIndexOf(pattern)+pattern.length===inputWord.length)&&(pattern.length<=inputWord.length)){
		console.log('YES');
		return;	
	}
	//文字列から10進数に変換するときはparseIntを使います
	var checkIndex = 0
	var changeCount = 0;
	var lastChangeIndex = 0;
	var ngFlg = false;
	for (var i = 0; i < tmp.length; i++) {
		if (tmp[i] == targetList[checkIndex]) {
			checkIndex++;
			continue;
		}
		check = pattern.slice(checkIndex);
		if((inputWord.lastIndexOf(check)+check.length===inputWord.length)&&(check.length<=inputWord.length)){
		console.log('YES');
		break;
		} else {
			console.log('NO')
			break;
		}

	}

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";

function main(input) {
  var lines = input.split('\n');
  var str = lines[0];
  var length = str.length;

  for (var start = 0; start < length; start++) {
    for (var end = start; end <= length; end++) {
      var s = str.slice(0, start) + str.slice(end);

      if (s === 'keyence') {
        console.log('YES');
        return;
      }
    }
  }

  console.log('NO');
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

function splitNum(line) {
  return line.split(/\s+/).map(function (n) {
    return parseInt(n);
  });
}
//  [javascript]
function Main(input) {
  input = input.split("\n");
  S=input[0];
  var ans="NO";
  for(var i=0;i<S.length-1;i++){
    for(var j=0;j<S.length;j++){
      S2=S.slice(0,i)+S.slice(j,S.length);
      if(S2=="keyence"){
        ans="YES";
      }
    }
  }

  console.log('%s', ans);
}
  
// "実行する"ボタンを押した時に実行される関数 (デバッグ用)
function debug(){
  var input = document.getElementById("input").value;
  Main(input);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var s = o.a(1);
  var x = "keyence";
  var N = "NO";
  for(var i = 0; i <= x.length; i++){
    if(s.match("^"+x.slice(0,i)+".*"+x.slice(i)+"$"))return "YES";
  }
  return "NO";
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()

	t := "keyence"

	for i := 0; i <= len(t); i++ {
		f0 := strings.HasPrefix(s, t[:i])
		f1 := strings.HasSuffix(s, t[i:])
		// out(t[:i], t[i:], s, f0, f1)
		if f0 && f1 {
			out("YES")
			return
		}
	}
	out("NO")
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()

	t := "keyence"
	l := 0
	for i := 0; s[i] == t[i]; i++ {
		l++
		if l == len(t) {
			break
		}
	}
	// out(l)

	rt := "ecneyek"
	r := 0
	for i := 0; i < 7; i++ {
		if s[len(s)-1-i] != rt[i] {
			break
		}
		r++
	}
	// out(r)

	if r+l >= 7 {
		out("YES")
	} else {
		out("NO")
	}

}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	resolve(parseProblem())
}

func parseProblem() string {
	return scanString(sc)
}

const (
	Pre = 0 + iota
	Removing
	Post
)

func resolve(str string) {
	const target = "keyence"
	if strings.HasSuffix(str, target) {
		fmt.Println("YES")
		return
	}
	if str[0:len(target)] == target {
		fmt.Println("YES")
		return
	}
	i := 0
	for ; i < len(str); i++ {
		if str[i] != target[i] {
			break
		}
	}
	if strings.HasSuffix(str, target[i:len(target)]) {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
	return
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var a string
	fmt.Scan(&a)
	target := "keyence"
	ans := ""
	for i := 0; i < 7; i++ {
		if a[i:i+1] == target[i:i+1] {
			ans = ans + a[i:i+1]
		} else {
			ans += a[len(a)+i-7 : len(a)]
			break
		}
	}
	if ans == target {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}

}
//  [go]
package main

import "fmt"

func main() {
	var S string
	fmt.Scan(&S)
	for i := 0; i <= len(S); i++ {
		for j := i; j <= len(S); j++ {
			s := S[:i] + S[j:]
			if s == "keyence" {
				fmt.Println("YES")
				return
			}
		}
	}
	fmt.Println("NO")
}
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
N=S.size
str=["k","e","y","e","n","c","e"]
if S[0..6]==str or S[N-7..N-1]==str
  puts "YES"
else
  6.times do|i|
    if S[0..i]+S[N-6+i..N-1]==str
        puts "YES"
        exit
    end
  end 
  puts "NO"
end
//  [ruby]
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
N=S.size
s="keyence".split("")
if S[0..6]==s or S[N-7..N-1]==s
    puts "YES"
    exit
end
flag=false
6.times do|i|
  if S[0..i]+S[N-6+i..N-1]==s
    flag=true
    break
  end 
end
puts yn_judge(flag,"YES","NO")
//  [ruby]
s = gets.chomp
res = s.match(/^(keyence|.+keyence|k.+eyence|ke.+yence|key.+ence|keye.+nce|keyen.+ce|keyenc.+e|keyence.+)$/)
puts res ? "YES" : "NO"
//  [ruby]
class Array
  # being_deleted must be sorted
  def delete_ats(being_deleted)
    tmp = []
    current = 0
    self.each_with_index do |a, i|
      if being_deleted[current] == i
        current += 1
      else
        tmp << a
      end
    end
    self.replace(tmp)
  end
end

s = gets.chomp.chars
(0..s.size).each do |from|
  (0..s.size - from).each do |length|
    copy = Marshal.load(Marshal.dump(s))
    copy.delete_ats((from...from + length).to_a)
    if copy.join == "keyence"
      puts "YES"
      exit
    end
  end
end
puts "NO"
//  [ruby]
#a, b = gets.split.map(&:to_i)
s = gets.chomp
n = s.size

for l in 0..n-1
    for r in l..n
        t = ''
        t += s[0..l-1] if l-1 >= 0
        t += s[r..-1] if r <= n-1
        #p t
        if  t == 'keyence'
            puts 'YES'
            exit
        end
    end
end

puts 'NO'
//  [ruby]
s = gets.chomp
len = s.length
len -= 1

(0..len).each do |i|
  (i..len).each do |j|
    str = s[0...i] + s[j..-1]
    
    if str == "keyence"
      puts "YES"
      exit
    end
  end
end

puts "NO"
//  [rust]
#[allow(unused_macros, dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
#[allow(unused_macros, dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
#[allow(unused_macros, dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    let mut c: Vec<char> = s.chars().collect();
    let mut s: Vec<char> = "keyence".chars().collect();

    let n = c.len();

    let mut cnt = 0;
    for i in 0..n {
        if c[i] == s[i] {
            cnt += 1;
        } else {
            break;
        }
    }
    for i in 0..n {
        if c[c.len() - 1 - i] == s[s.len() - 1 - i] {
            cnt += 1;
        } else {
            break;
        }
    }

    println!("{}", if cnt >= 7 { "YES" } else { "NO" });
}
//  [rust]
use std::io::*;
fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let s = itr.next().unwrap();

    let n = s.len();
    for i in 0..n {
        for j in i..n {
            let t = &s[..i];
            let u = t.to_string();
            let v = &s[j..];
            if u + v == "keyence" {
                println!("YES");
                return;
            }
        }
    }
    println!("NO");
}
//  [rust]
const KEYWORD: &'static str = "keyence";
fn main() {
    let mut s = String::with_capacity(100);
    let _ = std::io::stdin().read_line(&mut s);
    println!("{}", if solve(&s.trim()) { "YES" } else { "NO" });
}

fn solve(s: &str) -> bool {
    if s.starts_with(KEYWORD) || s.ends_with(KEYWORD) {
        return true;
    }
    for head_l in 0..(KEYWORD.len()) {
        if [
            &s[0..head_l],
            &s[s.len() - (KEYWORD.len() - head_l)..s.len()],
        ]
        .join("")
            == KEYWORD
        {
            return true;
        }
    }
    false
}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s:String = read();
    let chars:Vec<char> = s.chars().collect();
    let mut ans = "NO";
    'outer: for i in 0..s.len() {
        for j in i..s.len() {
            if format!("{}{}", &chars[..i].iter().collect::<String>(), &chars[j..].iter().collect::<String>()) == "keyence" {
                ans = "YES";
                break 'outer;
            }
        }
    }
    println!("{}", ans);
}
//  [swift]
let S = readLine()!.characters.map{$0}
let N = S.count
var ans = "NO"
for i in 0..<N {
  for j in i..<N {
    if String(S[0..<i]+S[j..<N]) == "keyence" {
      ans = "YES"
    }
  }
}
print(ans)
//  [typescript]
function solve(S:string):boolean{
    if(S.length<7)return false;
    const key="keyence";
    let pre=0;
    for(let i=0;i<7;i++){
        if(key[i]==S[i])pre++;
        else break;
    }
    let sur=0;
    for(let i=1;i<8;i++){
        if(key[7-i]==S[S.length-i])sur++;
        else break;
    }
    // console.log(pre+ sur);
    return pre + sur >=7;
}
function Main(raw: string) {
    const lines = raw.split("\n");
    const [firstLine] = lines;
    const S = firstLine;
    console.log(solve(S)?"YES":"NO");
}

//DO NOT EDIT
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0}):
#h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0}) # sample usage
    mp=[1]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)];rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

class Comb:
    def __init__(self,n,mo=10**9+7):
        self.fac=[0]*(n+1)
        self.inv=[1]*(n+1)
        self.fac[0]=1
        self.fact(n)
        for i in range(1,n+1):
            self.fac[i]=i*self.fac[i-1]%mo
            self.inv[n]*=i
            self.inv[n]%=mo
        self.inv[n]=pow(self.inv[n],mo-2,mo)
        for i in range(1,n):
            self.inv[n-i]=self.inv[n-i+1]*(n-i+1)%mo
        return
    
    def fact(self,n):
        return self.fac[n]
        
    def invf(self,n):
        return self.inv[n]

    def comb(self,x,y):
        if y<0 or y>x:
            return 0
        return self.fac[x]*self.inv[x-y]*self.inv[y]%mo

show_flg=False
show_flg=True

ans=0

n=I()
a=LI()
b=[0]*(n+1)
for i in a:
    b[i]+=1
for i in range(1,n+1):
    print(b[i])

#print(ans%mo)
//  [python]
import numpy as np

n = int(input())

As = np.asarray(input().split(), dtype=np.int32)

num = np.zeros(n, dtype=np.int32)

for i in range(n-1):
    num[As[i]-1] += 1

for i in range(n):
    print(num[i])
//  [python]
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    A=LI()
    ans = [0]*N
    for a in A:
        ans[a-1]+=1
    print(*ans,sep="\n")
if __name__ == '__main__':
    main()
//  [java]
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        Map<Integer, List<Integer>> map = new HashMap<>();
        for (int i = 1; i <= n; i++) {
            map.put(i, new ArrayList<>());
        }
        for (int i = 2; i <= n; i++) {
            a[i] = sc.nextInt();
            List<Integer> list = map.get(a[i]);
            list.add(i);
            map.put(a[i], list);
        }
        for (int i = 1; i <= n; i++) {
            List<Integer> list = map.get(i);
            System.out.println(list.size());
        }
    }

}
//  [java]
import java.util.Scanner;

public class Main {
	public static void main(String[] rags) {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int[] list = new int[n];

		for(int i =0;i < n - 1;i++) {
			list[scan.nextInt() - 1] += 1;
		}

		for(int i = 0;i < n;i++) {
			System.out.println(list[i]);
		}
	}
}
//  [java]
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		List<Integer> list = new ArrayList<Integer>();
		for(int i = 1; i < N; i++) {
			list.add(Integer.parseInt(sc.next()));
		}
		sc.close();
		
		list.stream().collect(Collectors.groupingBy(x -> x, Collectors.counting()));
		
		Map<Object, Long> map = list.stream().collect(Collectors.groupingBy(x -> x, Collectors.counting()));

		for(int i = 1; i < N + 1; i++) {
			if(map.get(i) == null) {
				System.out.println(0);
			}else {
				 System.out.println(map.get(i));
			}
		}
	}
}
//  [cpp]
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
using namespace std;

int main(void){
    int N;
  	scanf("%d", &N);
    int l, i=0, a[N-1];
    while(cin>>l){
        a[i] = l;
        i++;
    }
	for(i=0;i<N-1;i++){
      int ans=0;
      for(int j=i;j<N-1;j++){
        if(a[j]==i+1){
          ans++;
        }
      }
      printf("%d\n",ans);
	}
	printf("0");
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int, int>>> vvpp;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<pair<int, int>> vpp;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define all(n) (n).begin(), (n).end()
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void out(Arg1&& arg1) {
    cout << arg1 << '\n';
}

template <typename Arg1, typename ...Args>
void out(Arg1&& arg1, Args&& ...args) {
    cout << arg1 << ' ';
    out(args...);
}


template <typename T>
void outarr(vector<T> arr) {
    for (int i = 0; i < arr.size() -1; ++i) cout << arr[i] << ' ';
    cout << arr.back() << '\n';
}

template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    map<int, int> count;
    for (int i = 0; i < n -1 ; ++i) {
        int boss; cin >> boss;
        cerr << boss << ' ' << count[boss] << endl;
        count[boss] += 1;
    }

    for (int i = 1; i <= n; ++i) {
        cout << count[i] << '\n';
    }

    return 0;
}
//  [cpp]
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = 1; i < (int)(n); i++) 
#define dunk(n) cout << n << endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
typedef long long ll;

int main() {
    int n;
    cin >> n;
    vector<int> mem(n),under(n+1,0);
    mem[0] = 0;
    for(int i  = 1; i < n; i++){
        cin >> mem[i];
    }
    sort(all(mem));
    int num = 0;
    rep(i,n){
        while(mem[i] != num){
            num++; 
        }
        if(mem[i] == num) under[mem[i]]++;
    }
    rep(i,n) cout << under[i+1] << endl;
    return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
int cmpint(const void *x, const void *y) {
	return *(int *)x - *(int *)y;
}
int main() {
	int n, a[200000], num[200000] = {0};
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		scanf("%d", &a[i]);
		num[a[i] - 1]++;
	}
	qsort(a, n, sizeof(int), cmpint);
	for (int i = 0; i < n; i++) {
		printf("%d\n", num[i]);
	}
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int cmp(const void *a,const void *b)
{
    return *(int*)a-*(int*)b;
}

int main(void)
{
    int n;
    scanf("%d",&n);
    int a[n-1];
    for(int i=0;i<n-1;i++){
        scanf("%d",&a[i]);
    }
    qsort(a,n-1,sizeof(int),cmp);
    int num[n];
    for(int i=0;i<n;i++){
        num[i]=0;
    }
    for(int i=0;i<n-1;i++){
        int s=a[i]-1;
        num[s]++;
    }
    for(int i=0;i<n;i++){
        printf("%d\n",num[i]);
    }
    return 0;
}
//  [c]
#include <stdio.h>
 
int main(){
  int n, t;
  scanf("%d", &n);
  int a[2000000]={0};
  for(int i=0; i<n-1; i++){
    scanf("%d", &t);
    a[t-1]++;
  }
  for(int i=0; i<n; i++) printf("%d\n", a[i]);
}
//  [javascript]
const main = (inputs) => {
  var N = inputs[0] - 0;
  var array2 = inputs[1].split(" ");
  var sum = new Array(N).fill(0);

  array2.forEach(i => {
    var num = i - 1;
    sum[num] = sum[num] + 1;
  });

  sum.forEach(j => {
    console.log(j);
  });

}
main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
//  [javascript]
'use strict'
function main(inp) {
  inp = inp.trim().split('\n');
  let N = inp[0].split(' ')*1;
  let As = inp[1].split(' ').map(x => x*1);
  let ansArr = {};
  for(let i = 0; i < N - 1; i++){
    if(ansArr[As[i]] == undefined){
    	ansArr[As[i]] = 1; 
    }
    else {
        ansArr[As[i]]++; 
    }
  }
  for(let j = 1; j <= N; j++){
    console.log(ansArr[j] ? ansArr[j] : 0);
  }  
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");
    const n = Number(input[0])
    const as = input[1].split(" ").map(el => parseInt(el))
    let arr = new Array(n).fill(0)
    for(let a of as){
        arr[a-1] = arr[a-1] + 1
    }
    for(let el of arr){
        console.log(el)
    }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
)

type graph [][]int

func main() {
	var N int
	fmt.Scan(&N)

	graph1 := make(graph, N+1)

	for i := 2; i <= N; i++ {
		ai := 0
		fmt.Scan(&ai)
		graph1[ai] = append(graph1[ai], i)

	}
	// fmt.Println(graph1)
	for i := 1; i <= N; i++ {
		fmt.Println(len(graph1[i]))
	}
}
//  [go]
package main
 
import (
	"fmt"
)
 
var n, a int
var m map[int]int
func main() {
	fmt.Scan(&n)
	m = make(map[int]int, n)
	for i := 0; i < n - 1; i++ {
		fmt.Scan(&a)
		m[a]++
	}
	for i := 0; i < n; i++ {
	  fmt.Println(m[i + 1])
	}
}
//  [go]
package main

import "fmt"

func main() {
	boss := make(map[int]int)
	var n int
	fmt.Scan(&n)
	var a int
	for i := 1; i < n; i++ {
		fmt.Scan(&a)
		boss[a]++
	}
	for i := 1; i < n+1; i++ {
		v, isExist := boss[i]
		if isExist {
			fmt.Println(v)
		} else {
			fmt.Println("0")
		}
	}
}
//  [ruby]
lines = []
while line = gets
  lines << line.chomp.split(' ').map(&:to_i)
end

members = []
i = 0
lines[0][0].times do
  members[i] = 0
  i += 1
end

lines[1].each do |l|
  members[l.to_i - 1] += 1
end

members.each do |m|
  pp m.to_i
end
//  [ruby]
a=*?1..gets.chop;b=gets.split.tally;a.map{p b[_1]||0}
//  [ruby]
n = gets.chomp.to_i
array = gets.chomp.split.map(&:to_i)

hash = array.group_by(&:itself).map{ |key, value| [key, value.count] }.to_h

1.upto(n) do |i|
  p hash[i] || 0
end
//  [rust]
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::iter::*;
#[allow(unused_imports)]
use std::*;

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
#[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

fn main() {
    println!("{}", solve(&stdin!()));
}
fn solve(src: &str) -> String {
    input! {
        source = src,
        n:usize,
        a:[usize;n-1],
    }
    let mut employee_map = HashMap::new();
    employee_map.insert(1, 0);
    for (i, ai) in a.iter().enumerate() {
        let i = i + 2;
        employee_map.insert(i, 0);
        *employee_map.get_mut(ai).unwrap() += 1;
    }
    let mut employees = employee_map.iter().collect::<Vec<_>>();
    employees.sort_by_key(|(&k, _)| k);
    employees
        .iter()
        .fold(String::new(), |s, (_, v)| format!("{}{}\n", s, v))
}
test! {
    include_str!("c1_in.txt") => include_str!("c1_out.txt"),
    include_str!("c3_in.txt") => include_str!("c3_out.txt"),
}
//  [rust]
use proconio::input;
use std::iter::Iterator;
use std::collections::HashMap;

fn main() {
    input! {
    n: i32,
    mut a: [i32; n-1],
    }

    let mut map: HashMap<&i32, i32> = HashMap::new();
    
    for i in &a {
        map.entry(i).and_modify(|e| *e += 1).or_insert(1); 
    }

    dbg!(&map);

    for i in 1..=n {
        let count = map.get(&(i));
        let ans = match count{
            None => &0,
            Some(i) => i,
        };

        println!("{}", ans);
    }

}
//  [rust]
use text_io::*;
use std::process::exit;
use im_rc::HashMap;

fn main(){
    let mut n:isize = read!();
    let mut map= HashMap::new();
    let mut sum:usize = 0;
    for i in 0..n-1 {
        let mut s:usize = read!();
        let mut t: &i32 = map.get(&s).unwrap_or(&0);
        let mut o: &i32 = &1;
        map.insert(usize::from(s),t+o);
    }
    for i in 1..n+1 {
        println!("{}",map.get(&(*&i as usize)).unwrap_or(&0))
    }
}
//  [swift]
import Foundation

let input1: String = readLine()!
let N = Int(input1)!
let input2 = readLine()!
let bosses = input2.components(separatedBy: " ").map { Int($0)! }

var counts: [Int] = .init(repeating: 0, count: N)

for b in bosses {
  counts[b-1] += 1
}
for v in counts {
  print(v)
}