CF 1741A - Compare T-Shirt Sizes
Two T-shirt sizes are given: a and b. The T-shirt size is either a string M or a string consisting of several (possibly zero) characters X and one of the characters S or L.
For example, strings M, XXL, S, XXXXXXXS could be the size of some T-shirts. And the strings XM, LL, SX are not sizes.
The letter M stands for medium, S for small, L for large. The letter X refers to the degree of size (from eXtra). For example, XXL is extra-extra-large (bigger than XL, and smaller than XXXL).
You need to compare two given sizes of T-shirts a and b.
The T-shirts are compared as follows:
any small size (no matter how many letters X) is smaller than the medium size and any large size;
any large size (regardless of the number of letters X) is larger than the medium size and any small size;
the more letters X before S, the smaller the size;
the more letters X in front of L, the larger the size.
----------------------------------------------------------------------------
給出了兩種 T 恤尺寸:a 和 b。 T 恤尺寸可以是字符串 M,也可以是由幾個(可能為零)字符 X 和字符 S 或 L 之一組成的字符串。
例如,字符串 M、XXL、S、XXXXXXXS 可能是某些 T 恤的尺寸。 并且字符串 XM、LL、SX 不是尺寸。
字母M代表中號,S代表小號,L代表大號。 字母 X 表示尺寸大?。▉碜?eXtra)。 例如,XXL 是特大號(比 XL 大,比 XXXL ?。?/p>
您需要比較 T 恤 a 和 b 的兩個給定尺寸。
T恤對比如下:
任何小尺寸(無論有多少個字母 X)均小于中尺寸和任何大尺寸;
任何大尺寸(無論字母 X 的數(shù)量)大于中尺寸和任何小尺寸;
S前面的X字母越多,尺寸越?。?/p>
L前面的X字母越多,尺寸越大。
------------------
這里面主要是要注意最后一個點,S的時候,出現(xiàn)X越多則越小,其他則是越大;
下面是代碼: