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

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        String[] players = {"mumu", "soe", "poe", "kai", "mine"};
        String[] callings = {"kai", "kai", "mine", "mine"};
        
        System.out.println(solution(players, callings));
    }
    
    public static String[] solution(String[] players, String[] callings) {
        Map<String, Integer> map =  new HashMap<>();
        
        for (int i = 0; i < players.length; i++) {
            map.put(players[i], i);
        }
        
        for (String calling : callings) {
            int index = map.get(calling);
            
            if(index > 0) {
                String fP = players[index - 1];
                players[index - 1] = players[index];
				players[index] = fP;
                
                map.put(calling, index - 1);
				map.put(fP, index);
            }
        }
        
        return players;
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: