CodeWars 예순 세 번째 문제

Updated:

Word a10n (abbreviation)

public static String abbreviate(String string) {

    String[] splitWords = string.split("[^a-zA-Z]");

    for(String splitWord : splitWords) {
        if(splitWord.length() > 3) {
            string = string.replaceFirst(splitWord, abbreviatorWord(splitWord));
        }
    }

    return string;
}

public static String abbreviatorWord(String word) {
    return word.substring(0,1) + (word.length()-2) + word.substring(word.length()-1);
}
  • 문제는 어렵지 않았다.
  • 좋아요가 가장 많은 Best 코드는 나보다 코드가 구렸다.
  • 아래 좋아요가 적은 Best 코드가 나랑 같은 코드들이었다.
  • 역시나 뭐든지 상단에 있는게 좋은가 보다. 언론의 조작… 그냥 개소리다 ㅅㄱ