forked from ngthanhtrung23/CompetitiveProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB.cob
More file actions
26 lines (24 loc) · 779 Bytes
/
B.cob
File metadata and controls
26 lines (24 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
IDENTIFICATION DIVISION.
PROGRAM-ID. SOLUTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC 9(10) VALUE ZEROES.
01 B PIC 9(10) VALUE ZEROES.
01 STR PIC X(100).
01 RES PIC X(100).
01 F PIC 9(1).
01 T PIC 9(10).
PROCEDURE DIVISION.
ACCEPT STR
MOVE STR TO A
MOVE '' TO STR
perform UNTIL A IS EQUAL TO ZERO
DIVIDE 2 INTO A GIVING B REMAINDER F
MOVE B TO A
string F DELIMITED BY SPACE
STR DELIMITED BY SIZE into STR
end-perform.
MOVE LENGTH OF STR TO T
SUBTRACT 1 FROM T
display STR(2:T)
STOP RUN.