Guest User

Untitled

a guest
Jun 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. # -*- coding: utf-8 -*-
  3.  
  4. str = '暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇蝦暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇暇'
  5. arr = str.split(/\s*/)
  6.  
  7. arr.each_with_index do |hima, index|
  8. if arr[index] != arr[index - 1]
  9. puts "#{index + 1}番目が#{hima}です"
  10. end
  11. end
Add Comment
Please, Sign In to add comment