program-id.y.data division.working-storage section. 1 i pic 999. 1 s pic x(999). 1 t pic x(999). procedure division.a.accept t move 0 to i.b.add 1 to i if""<t(i:1)move t(i:)to s(i:1).if i<999 go b.display function trim(s)if""<t(13:1)if""<t(3:1)go a.
Note that non-ascii characters in the above source code will be escaped (such as \x9f).