Created
August 7, 2018 07:02
-
-
Save ebongzzang/6191813a530dd2f7429091222c97c22d to your computer and use it in GitHub Desktop.
kakao_Recruitment_5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main2() { | |
// def reader = new Scanner(System.in) | |
// String str1 = reader.next() | |
// String str2 = reader.next() | |
// | |
// println(str1, str2) | |
def characters = 'FRANCE'.trim().toCharArray() | |
def characters2 = 'french'.trim().toCharArray() | |
def count = characters.size() - 1 | |
def count2 = characters2.size() - 1 | |
println(characters) | |
println(characters2) | |
List<String> array = [] | |
List<String> array2 = [] | |
count.times { | |
array[it] = ("${characters[it]}${characters[it + 1]}") | |
} | |
count2.times { | |
array2[it] = ("${characters2[it]}${characters2[it + 1]}") | |
} | |
array = array.collect { it -> it.toUpperCase() } | |
array2 = array2.collect { it -> it.toUpperCase() } | |
def union = [array, array2].toList().flatten() | |
println(union) | |
def intersect = [array, array2].flatten().toSet() | |
println(intersect) | |
intersect.each { | |
union.remove(it) | |
} | |
println(Math.round((union.size() / intersect.size() * 65536))) | |
} | |
main2() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment