Edited at

ずんだの表見出し++問題 Ruby 編

More than 1 year has passed since last update.


プログラム(Ruby)

DATA.each_line.map do |e|

row = e.split('|')
row[0] = row[0].to_i + 1
print row.join('|')
end

__END__
0|col1|col2|col3
1|col1|col2|col3
2|col1|col2|col3
3|col1|col2|col3
4|col1|col2|col3


出力

1|col1|col2|col3

2|col1|col2|col3
3|col1|col2|col3
4|col1|col2|col3
5|col1|col2|col3