#K7441. File Path Compression

    ID: 34191 Type: Default 1000ms 256MiB

File Path Compression

File Path Compression

Given a file path represented as a string, compress the path by replacing any contiguous sequence of identical sub-directory names with the directory name followed by the count of its consecutive occurrences.

For example, the path path/compression/compression/compression/test should be compressed to path/compression3/test.

The compression follows the formula: \[ compressed = element \; (if ~occurrence = 1) \quad or \quad element\;n \; (if ~element ~repeats ~n ~times consecutively) \]

Your task is to implement a solution that reads a file path from stdin, compresses it, and writes the result to stdout.

inputFormat

The input consists of a single line which contains the file path string. The directory names are separated by the '/' character. The input may be empty.

outputFormat

Output the compressed file path as a single string. If the input is empty, output an empty string.

## sample
path/compression/compression/compression/test
path/compression3/test