Team Ai
Datasetpublic

prithivMLmods/Coder-Stat

Coder-Stat Dataset Overview The Coder-Stat dataset is a collection of programming-related data, including problem IDs, programming languages, original statuses, and source code snippets. This dataset is designed to assist in the analysis of coding patterns, error types, and performance metrics. Dataset Details Modalities Tabular: The dataset is structured in a tabular format. Text: Contains text data, including source code snippets.… See the full description on the dataset page: https://huggingface.co/datasets/prithivMLmods/Coder-Stat.

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
3likes139downloads
p00875.html110 linesDownload Raw Back to problem_descriptions
1 2<H1><font color="#000">Problem B:</font> Repeated Substitution with Sed</H1>3 4<p>5Do you know "sed," a tool provided with Unix? Its most popular use is to substitute every6occurrence of a string <i.&alpha;</i> contained in the input string (actually each input line) with another7string <i>&beta;</i>. More precisely, it proceeds as follows.8</p>9 10<ol>11   <li> Within the input string, every non-overlapping (but possibly adjacent) occurrences of <i>&alpha;</i> are12      marked. If there is more than one possibility for non-overlapping matching, the leftmost13      one is chosen.</li>14   <li> Each of the marked occurrences is substituted with <i>&beta;</i> to obtain the output string; other15      parts of the input string remain intact.</li>16</ol>17 18<p>19For example, when <i>&alpha;</i> is "<span>aa</span>" and <i>&beta;</i> is "<span>bca</span>", an input string "<span>aaxaaa</span>" will produce "<span>bcaxbcaa</span>",20but not "<span>aaxbcaa</span>" nor "<span>bcaxabca</span>". Further application of the same substitution to the string21"<span>bcaxbcaa</span>" will result in "<spna>bcaxbcbca</span>", but this is another substitution, which is counted as the22second one.23</p>24<p>25In this problem, a set of substitution pairs (<i>&alpha;<sub>i</sub></i>, <i>&beta;<sub>i</sub></i>) (<i>i</i> = 1, 2, ... , <i>n</i>), an initial string <i>&gamma;</i>, and a26final string <i>&delta;</i> are given, and you must investigate how to produce <i>&delta;</i> from <i>&gamma;</i> with a minimum27number of substitutions. A single substitution (<i>&alpha;<sub>i</sub></i>, <i>&beta;<sub>i</sub></i>) here means simultaneously substituting28all the non-overlapping occurrences of <i>&alpha;<sub>i</sub></i>, in the sense described above, with <i>&beta;<sub>i</sub></i>.29</p>30 31<p>32You may use a specific substitution (<i>&alpha;<sub>i</sub></i>, <i>&beta;<sub>i</sub></i> ) multiple times, including zero times.33</p>34 35<H2>Input</H2>36 37<p>38The input consists of multiple datasets, each in the following format.39</p>40 41<p>42      <i>n</i><br>43      <i>&alpha;</i><sub>1</sub> <i>&beta;</i><sub>1</sub><br>44      <i>&alpha;</i><sub>2</sub> <i>&beta;</i><sub>2</sub><br>45      .<br>46      .<br>47      .<br>48      <i>&alpha;</i><sub><i>n</i></sub> <i>&beta;</i><sub><i>n</i></sub><br>49      <i>&gamma;</i></br>50      <i>&delta;</i></br>51</p>52 53<p>54<i>n</i> is a positive integer indicating the number of pairs. <i>&alpha;<sub>i</sub></i> and <i>&beta;<sub>i</sub></i> are separated by a single space.55You may assume that 1 &le; |<i>&alpha;<sub>i</sub></i>| &lt; |<i>&beta;<sub>i</sub></i>| &le; 10 for any <i>i</i> (|<i>s</i>| means the length of the string <i>s</i>),56 57<i>&alpha;<sub>i</sub></i> &ne; <i>&alpha;<sub>j</sub></i> for any <i>i</i> &ne; <i>j</i>, <i>n</i> &le; 10 and 1 &le; |<i>&gamma;</i>| &lt; |<i>&delta;</i>| &le; 10. All the strings consist solely of lowercase58letters. The end of the input is indicated by a line containing a single zero.59</p>60 61<H2>Output</H2>62 63<p>64For each dataset, output the minimum number of substitutions to obtain <i>&delta;</i> from <i>&gamma;</i>. If <i>&delta;</i> cannot65be produced from <i>&gamma;</i> with the given set of substitutions, output <span>-1</span>.66 67</p>68 69<H2>Sample Input</H2>70<pre>71272a bb73b aa74a75bbbbbbbb76177a aa78a79aaaaa80381ab aab82abc aadc83ad dee84abc85deeeeeeeec861087a abc88b bai89c acf90d bed91e abh92f fag93g abe94h bag95i aaj96j bbb97a98abacfaabe990100</pre>101 102<H2>Output for the Sample Input</H2>103<pre>1043105-110671074108</pre>109 110