#!/usr/bin/env python3

import sys

def shorten(label):
  parts = label.split(":")
  if len(parts) == 1:
    return label
  dir = parts[0].split("/")[-1]
  if dir == parts[1]:
    return parts[0]
  else:
    return label

for label in sys.argv[1:]:
  print(shorten(label))
