#K48102. Divide a String into 'a' and 'b' Parts
Divide a String into 'a' and 'b' Parts
Divide a String into 'a' and 'b' Parts
Given a string ( s ) composed exclusively of the characters a
and b
, determine whether you can split it into two non‑empty parts ( s_1 ) and ( s_2 ) such that ( s_1 ) consists solely of a
and ( s_2 ) consists solely of b
.
If such a division exists, output the two parts separated by a single space. Otherwise, output NO
.
inputFormat
A single line containing a string ( s ) made up of only a
and b
.
outputFormat
If the division is possible, output the two parts separated by a single space. Otherwise, output NO
.## sample
aaabbb
aaa bbb