strip common prefix