fork download
  1. # answer: http://o...content-available-to-author-only...e.jp/qa/q6932517.html
  2.  
  3. SUFFIXES = %w[f s]
  4.  
  5. $stdin.each.with_index do |line, idx|
  6. mark, number = line.split ' '
  7. puts ">#{mark}#{SUFFIXES[idx % 2]}", ">#{number}"
  8. end
Success #stdin #stdout 0s 4760KB
stdin
A 1234
A 2345
B 3456
B 4567
stdout
>Af
>1234
>As
>2345
>Bf
>3456
>Bs
>4567