It may consist of a group of letters, or words assumed from the full version of the word or phrase; for example, the word abbreviation can itself be represented by the abbreviation abbr. An abbreviation (from Latin brevis, meaning short) is a shortened form of a word or phrase, by any method. After universe War II, the British greatly reduced the purpose of the full stop and other punctuation points after abbreviations in at least semi-formal writing, while the Americans more readily keep such purpose until more recently, and still keep it more than Britons. In Roman inscriptions," word were normally abbreviated by use the initial letter or letters of words, and most inscriptions have at least one abbreviation."(For example, A can be an abbreviation for many words, such as ager, amicus, annus, as, Aulus, Aurelius, aurum and avus.)"Abbreviations in English were frequently used from its earliest days.
""" https://www.hackerrank.com/challenges/abbr/problem You can perform the following operation on some string, : 1. Capitalize zero or more of 's lowercase letters at some index i (i.e., make them uppercase). 2. Delete all of the remaining lowercase letters in . Example: a=daBcd and b="ABC" daBcd -> capitalize a and c(dABCd) -> remove d (ABC) """ def abbr(a: str, b: str) -> bool: """ >>> abbr("daBcd", "ABC") True >>> abbr("dBcd", "ABC") False """ n = len(a) m = len(b) dp = [[False for _ in range(m + 1)] for _ in range(n + 1)] dp = True for i in range(n): for j in range(m + 1): if dp[i][j]: if j < m and a[i].upper() == b[j]: dp[i + 1][j + 1] = True if a[i].islower(): dp[i + 1][j] = True return dp[n][m] if __name__ == "__main__": import doctest doctest.testmod()