Strings manipulation using qualitative reasoning