Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package clb_tin_hoc;
- import java.util.Scanner;
- public class Clb_Tin_hoc {
- public static void main(String[] args) {
- Scanner Sc=new Scanner(System.in);
- int n;
- n=Integer.parseInt(Sc.nextLine());
- String[] A=new String[n];
- String[] B=new String[n];
- for(int i=0;i<n;i++)
- {
- do{
- A[i]=Sc.nextLine();
- }while(A[i].length()>32);
- }
- for(int i=0;i<n;i++)
- {
- int count=0;
- for(int j=i+1;j<n;j++)
- {
- if(A[i].equals(A[j]))
- {
- count++;
- A[j]+=Integer.toString(count);
- B[j]=A[j];
- }
- }
- }
- System.out.println("___Output___ ");
- for(int i=0;i<n;i++)
- {
- if(B[i]==null) System.out.println("OK");
- else System.out.println(""+B[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement