input problem

how to input in problem http://www.codechef.com/problems/A6#comment-43555 plzz tell especially how to input sequence b???
also tell how to give output should i just print it?
or plz correctify this http://www.codechef.com/viewsolution/2175401.

do not print Enter Sequence etc. just take in input and dish out the output.

1 Like

@aasthi : on any online programming contest environment or practise website, u have to STRICTLY follow the input output format that they specify. Now, you do not have to print lines that prmopts the user, unless specified. so you never write this:
System.out.println(“Enter the first sequence”);
unless mentioned to do so. Plus, your code’s status is compilation error, which i think is because of class name. when you submit a code in java, if your class is public, you have to name it as Main… so its always one of the following 2:

  • public class Main
  • class anyOtherClassName
try considering these points, might help and revert back if it still doesnot! :)
4 Likes

@aasthi :

  • For console apps, use a single Scanner to read from System.in. Java input classes such as Scanner and BufferedInputStream facilitate fast, nonblocking I/O by buffering an underlying input stream. Programs can create multiple wrappers on an InputStream. Programs that use multiple wrappers around a single input stream, however, can behave unpredictably depending on whether the wrappers allow look-ahead. An attacker can exploit this difference in behavior by, for example, redirecting System.in (from a file) or by using the System.setIn() method to redirect System.in. In general, any input stream that supports nonblocking buffered I/O is susceptible to this form of misuse.
  • An input stream must not have more than one buffered wrapper. Instead, create and use only one wrapper per input stream, either by passing it as an argument to the methods that need it or by declaring it as a class variable.
  • Hence, use only one stream of input(in your case you did use r1,r2 and many more).
  • Here is your code with corrected input(apply your logic further on) : http://ideone.com/B66NXw
8 Likes

thanks for the previous reply @sunny_patel , i have tried to change the input pattern and also the compilation error , but still its giving error, my code is working but not getting what kind of submission it wants as its my first submission on codechef ,can u plz do me a favour and can make changes like whatever name of class it wants and so , so i get that how should i code or give the input to submit properly. PLZ…:slight_smile:
and also in question it is not giveing b as input so how we should give b as input…

Post the link to modified code.

@bit_cracker007: you can easily find all his submissions - http://www.codechef.com/status/A6?language=All&status=All&handle=aasthi&sort_by=All&sorting_order=asc&Submit=GO

i am a beginner ,i am still not able to change the inputs …can u plz correct the whole code http://www.codechef.com/viewsolution/2175859, actually what changes should be made to input b (the main sequence) and c (the subsequence). Its my 1st time at codechef plz help me out for input in this so that I am able to do the next questions and thanks for ur concern…:slight_smile:

Then,I would suggest you to learn C/C++. Start with TEST Problem.
If you are more interested in JAVA, then have a look at java solutions of TEST problem.

Link : http://www.codechef.com/status/INTEST?language=10&status=15&handle=&sort_by=All&sorting_order=asc&Submit=GO

  • This discussion community is being managed by users like you. We can help you where you got stuck up , but we are not going to write entire code :slight_smile:

One more test problem :