Untitled

 avatar
unknown
plain_text
2 years ago
1.2 kB
5
Indexable
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package btvn;

import java.util.ArrayList;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 *
 * @author ADMIN
 */
public class TN06 {

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

        int N = in.nextInt();

        in.nextLine();
        ArrayList<String> list = new ArrayList<>();
        int count=1;
        while (N > 0) {
            N--;

            String s = in.nextLine();
            String str="";
            s = s.trim();
            s = s.replaceAll("\\s+"," ");
            String tmp[] = s.split(" ");
            str= str+ tmp[tmp.length-1];
            for(int i=0;i<tmp.length-1;i++){
                str= str + tmp[i].charAt(0);
            }
            str=str.toLowerCase();
            if(list.contains(str)&&!list.isEmpty()){
                count++;
                str=str+count;
            }
            list.add(str);
            System.out.println(str + "@ptit.edu.vn");
        }
    }
}
Editor is loading...