<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<!-- DOMjudge version 3.3.2 -->
<title>Source: s912</title>
<link rel="shortcut icon" href="../images/favicon.png" type="image/png" />
<link rel="stylesheet" href="../style.css" type="text/css" />
<link rel="stylesheet" href="style_jury.css" type="text/css" />
<script type="text/javascript" src="../js/sorttable.js"></script>
<script type="text/javascript" src="../js/domjudge.js"></script>
</head>
<body>

<h2>Source code for submission s912</h2>

<p><a href="#diff">Go to diff to previous submission</a></p>

<div class="tabber"><div class="tabbertab"><h2 class="filename"><a name="source0"></a>bugs.c</h2> 

<pre class="c" style="font-family:monospace;"><ol><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #339933;">#include &lt;string.h&gt;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #993333;">int</span> N<span style="color: #339933;">,</span>i<span style="color: #339933;">,</span>j<span style="color: #339933;">,</span>len<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #993333;">char</span> B<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1001</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>line<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1001</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>c<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,&amp;</span>N<span style="color: #339933;">,</span>B<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span>EOF<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>N<span style="color: #339933;">&gt;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">&amp;&amp;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%c&quot;</span><span style="color: #339933;">,&amp;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span>EOF<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">==</span><span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #339933;">--</span>N<span style="color: #339933;">;</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/putchar.html"><span style="color: #000066;">putchar</span></a><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">==</span>B<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          line<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>c<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%c&quot;</span><span style="color: #339933;">,&amp;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span>N<span style="color: #339933;">&gt;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">&amp;&amp;</span>i<span style="color: #339933;">&lt;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html"><span style="color: #000066;">strlen</span></a><span style="color: #009900;">&#40;</span>B<span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span>c<span style="color: #339933;">==</span>B<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;++</span>i<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            line<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>c<span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/scanf.html"><span style="color: #000066;">scanf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%c&quot;</span><span style="color: #339933;">,&amp;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span>EOF<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">break</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <span style="color: #666666; font-style: italic;">//if(c=='\n') break; </span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">!=</span><a href="http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html"><span style="color: #000066;">strlen</span></a><span style="color: #009900;">&#40;</span>B<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            line<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">            <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <a href="http://www.opengroup.org/onlinepubs/009695399/functions/ungetc.html"><span style="color: #000066;">ungetc</span></a><span style="color: #009900;">&#40;</span>c<span style="color: #339933;">,</span>stdin<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">        <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">          <a href="http://www.opengroup.org/onlinepubs/009695399/functions/putchar.html"><span style="color: #000066;">putchar</span></a><span style="color: #009900;">&#40;</span>c<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">      <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">    <span style="color: #808080; font-style: italic;">/*while(fgets(line,1000,stdin)!=EOF){</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">&nbsp;     len=strlen(line);</span></div></li><li style="font-weight: bold; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">&nbsp;     for(i=0;i&lt;=;++i)</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #808080; font-style: italic;">&nbsp;   }*/</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #009900;">&#125;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">  <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span></div></li><li style="font-weight: normal; vertical-align:top;"><div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #009900;">&#125;</span></div></li></ol></pre></div></div><h2><a name="diff"></a>Diff to submission <a href="870">s870</a></h2>
<div class="tabber"><div class="tabbertab"><h2 class="filename"><a name="diff"></a>bugs.c</h2>

<pre class="output_text"><span class='diff-del'>--- c4.s870.cteam125.bugs.c.0.bugs.c</span>
<span class='diff-add'>+++ c4.s912.cteam125.bugs.c.0.bugs.c</span>
@@ -6,18 +6,23 @@
   char B[1001],line[1001],c;
   while(scanf(&quot;%d%s\n&quot;,&amp;N,B)!=EOF){
<span class='diff-del'>-    while(scanf(&quot;%c&quot;,&amp;c)!=EOF){</span>
<span class='diff-del'>-      if(c==B[0]){</span>
<span class='diff-del'>-        line[0]=c;</span>
<span class='diff-del'>-        for(i=1,scanf(&quot;%c&quot;,&amp;c);i&lt;strlen(B)&amp;&amp;c==B[i];++i){</span>
<span class='diff-del'>-          line[i]=c;</span>
<span class='diff-del'>-          if(scanf(&quot;%c&quot;,&amp;c)==EOF) break;</span>
<span class='diff-del'>-        }</span>
<span class='diff-del'>-        if(i!=strlen(B)){</span>
<span class='diff-del'>-          line[i]='\0';</span>
<span class='diff-del'>-          printf(&quot;%s&quot;,line);</span>
<span class='diff-del'>-        }</span>
<span class='diff-del'>-        ungetc(c,stdin);</span>
<span class='diff-del'>-      }else</span>
<span class='diff-del'>-        putchar(c);</span>
<span class='diff-add'>+    while(N&gt;0&amp;&amp;scanf(&quot;%c&quot;,&amp;c)!=EOF){</span>
<span class='diff-add'>+      if(c=='\n'){ --N; putchar(c);</span>
<span class='diff-add'>+      }else{</span>
<span class='diff-add'>+        if(c==B[0]){</span>
<span class='diff-add'>+          line[0]=c;</span>
<span class='diff-add'>+          scanf(&quot;%c&quot;,&amp;c);</span>
<span class='diff-add'>+          for(i=1;N&gt;0&amp;&amp;i&lt;strlen(B)&amp;&amp;c==B[i];++i){</span>
<span class='diff-add'>+            line[i]=c;</span>
<span class='diff-add'>+            if(scanf(&quot;%c&quot;,&amp;c)==EOF) break;</span>
<span class='diff-add'>+            //if(c=='\n') break; </span>
<span class='diff-add'>+          }</span>
<span class='diff-add'>+          if(i!=strlen(B)){</span>
<span class='diff-add'>+            line[i]='\0';</span>
<span class='diff-add'>+            printf(&quot;%s&quot;,line);</span>
<span class='diff-add'>+          }</span>
<span class='diff-add'>+          ungetc(c,stdin);</span>
<span class='diff-add'>+        }else</span>
<span class='diff-add'>+          putchar(c);</span>
<span class='diff-add'>+      }</span>
     }
     /*while(fgets(line,1000,stdin)!=EOF){
</pre>

</div></div>
</body>
</html>
