{"id":62,"date":"2013-03-15T18:35:29","date_gmt":"2013-03-15T10:35:29","guid":{"rendered":"http:\/\/blog.dayandcarrot.net\/?p=62"},"modified":"2013-03-15T18:35:29","modified_gmt":"2013-03-15T10:35:29","slug":"1050-string-subtraction-20-%e6%97%b6%e9%97%b4%e9%99%90%e5%88%b6-10-ms-%e5%86%85%e5%ad%98%e9%99%90%e5%88%b6-32000-kb-%e4%bb%a3%e7%a0%81%e9%95%bf%e5%ba%a6%e9%99%90%e5%88%b6-16000-b-%e5%88%a4","status":"publish","type":"post","link":"https:\/\/dayandcarrot.space\/?p=62","title":{"rendered":"1050. String Subtraction (20)"},"content":{"rendered":"<p>1050. String Subtraction (20)<br \/>\n\u65f6\u95f4\u9650\u5236<br \/>\n10 ms<br \/>\n\u5185\u5b58\u9650\u5236<br \/>\n32000 kB<br \/>\n\u4ee3\u7801\u957f\u5ea6\u9650\u5236<br \/>\n16000 B<br \/>\n\u5224\u9898\u7a0b\u5e8f<br \/>\nStandard<br \/>\nGiven two strings S1 and S2, S = S1 &#8211; S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 &#8211; S2 for any given strings. However, it might not be that simple to do it fast.<br \/>\nInput Specification:<br \/>\nEach input file contains one test case. Each case consists of two lines which gives S1 and S2, respectively. The string lengths of both strings are no more than 104. It is guaranteed that all the characters are visible ASCII codes and white space, and a new line character signals the end of a string.<br \/>\nOutput Specification:<br \/>\nFor each test case, print S1 &#8211; S2 in one line.<br \/>\nSample Input:<\/p>\n<pre>\nThey are students.\naeiou\n<\/pre>\n<p>Sample Output:<\/p>\n<pre>\nThy r stdnts.\n<\/pre>\n<p>===================================================<br \/>\n\u4e0d\u7528\u52a8\u5565\u8111\u5b50\u7684\u4e00\u9053\u9898\uff0c\u53ea\u8981\u907f\u514d\u4f7f\u7528cin\/cout\u5c31\u884c\u4e86\u3002\u53cd\u6b63\u5185\u5b58\u7ed9\u4e86\u597d\u5927\u597d\u5927\uff0c\u8981\u4e89\u53d6\u65f6\u95f4\u7684\u8bdd\uff0c\u5c31\u7ed9\u4e00\u5171128\u4e2aascii\u5b57\u7b26\u505a\u4e2amap\uff0c\u91cc\u9762\u5b58\u653e\u662f\u4e0d\u662f\u88abban\u6389\u4e86\u3002<br \/>\n===================================================<\/p>\n<pre>\n#include <stdio.h>\nusing namespace std;\nstatic char S1[10000];  \/\/S1\nstatic char S2[10000];  \/\/S2\nstatic char S3[10000];  \/\/result\nstatic bool mapAscii[127];\nint main()\n{\n\tchar* pS1 = &S1[0];\n\tchar* pS2 = &S2[0];\n\tgets(pS1);\n\tgets(pS2);\n\tint asc;\n\twhile( (*pS2) != '\u0000')\n\t{\n\t\tasc = (int)(*pS2);\n\t\tmapAscii[asc] = true;\n\t\tpS2++;\n\t}\n\tchar* pS3 = &S3[0];\n\twhile( (*pS1) != '\u0000')\n\t{\n\t\tasc = (int)(*pS1);\n\t\tif(!mapAscii[asc])\n\t\t{\n\t\t\t(*pS3) = (char) asc;\n\t\t\tpS3++;\n\t\t}\n\t\tpS1++;\n\t}\n\t(*pS3) = '\u0000'; \/\/ EOL\n\tputs(&S3[0]);\n\t\/\/system(\"pause\");\n\treturn 0;\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1050. String Subtraction (20) \u65f6\u95f4\u9650\u5236 10 ms \u5185\u5b58\u9650\u5236 32000 kB \u4ee3\u7801\u957f\u5ea6\u9650\u5236 16000 B \u5224\u9898\u7a0b\u5e8f Standard Given two strings S1 and S2, S = S1 &#8211; S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 &#8211; S2 for any given strings. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[84],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-study","tag-pat"],"_links":{"self":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/62","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=62"}],"version-history":[{"count":0,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dayandcarrot.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}