#K82247. Hexadecimal Sequence Extraction

    ID: 35933 Type: Default 1000ms 256MiB

Hexadecimal Sequence Extraction

Hexadecimal Sequence Extraction

You are given a string s that contains a mixture of hexadecimal and non-hexadecimal characters. A hexadecimal digit is any of the characters that belong to the set \(\{0, 1, \dots, 9, A, B, C, D, E, F, a, b, c, d, e, f\}\). Your task is to extract all contiguous substrings (sequences) from the given string that:

  • Contain only hexadecimal digits.
  • Have a length of at least 2.

The extraction must obey word boundaries, i.e. the sequence is delimited by any characters that are not hexadecimal digits. Print the extracted sequences in the order in which they appear in the string. If there are no valid hexadecimal sequences, output an empty line.

inputFormat

The input consists of a single line string s read from standard input (stdin).

Note: The string may contain spaces, punctuation, and other non-hexadecimal characters.

outputFormat

Output the extracted hexadecimal sequences, separated by a single space, to standard output (stdout). If no valid sequence is found, output an empty line.

## sample
ABC 123 456 DEF
ABC 123 456 DEF