Please help me to solve this.

In a datatable, I need to reiterate numbers based on the values available in another column.

(the data in columnA is sorted)

What I have:

ColumnA ColumnB

A_1_X

A_1_X

A_1_X

A_1_Y

A_1_Y

A_2_X

A_2_X

A_2_Y

B_1_X

B_1_X

B_1_Y

What I need:

ColumnA ColumnB

A_1_X 1

A_1_X 2

A_1_X 3

A_1_Y 1

A_1_Y 2

A_2_X 1

A_2_X 2

A_2_Y 1

B_1_X 1

B_1_X 2

B_1_Y 1

Since dealing with datatable with large data, I am trying in LinQ Query instead of For Each loop:

Please help me