내 코드는 내가 매우 큰 문자열과 같은 큰 문자열이 있으면 내가 원하기 때문에 다음이 프로세스가 이러한 유형의 결과에 6.50 초 을분할
str = "Early in his first term in office, Obama signed into law economic stimulus legislation in response"
arr= str.split(" ")
set_element= arr.each_cons(2).to_a
sub_str = set_element.map {|i| i.join(' ')}
여기에 효율적인 방법으로 부분에 캐릭터
sub_str= ["Early in", "in his", "his first", "first term", "term in", "in office,", "office, Obama", "Obama signed", "signed into", "into law", "law economic", "economic stimulus", "stimulus legislation", "legislation in", "in response"]
은 가능한 임의 효율적인 방법과 다른 방법
끝내 주셔서 감사합니다. –