Nine degrees oj-Topic 1049: String to go to a specific character

Source: Internet
Author: User

Title Description:

The input string s and the character C are required to remove all C characters from S and output the result.

Input:

The test data has multiple groups, each set of input string s and the character C.

Output:

For each set of inputs, the output removes the result after the C character.

Sample input:
Healloa
Sample output:
Hello
Source:
2009 The computer Research of Harbin Institute of Technology The real problem
FAQ:

Problem solving problems? to discuss the subject of discussion please visit: http://t.jobdu.com/thread-7773-1-1.html


Import java.util.*; public class Main {public     static void Test (String str, char c) {for        (int i = 0; i < str.length (); i++) {            if (Str.charat (i)! = c) {                System.out.print (Str.charat (i));            } else                continue;}    }     public static void Main (String args[]) {        Scanner cin = new Scanner (system.in);        String A;        String BB;        while (Cin.hasnext ()) {            a = Cin.nextline ();            bb = Cin.nextline ();            Char b = bb.charat (0);            Test (A, b);            System.out.print ("\ n");}}    /**************************************************************    problem:1049    user:vhreal    Language:java    result:accepted    time:80 ms    memory:15416 kb***************************************** ***********************/


Nine degrees oj-Topic 1049: String to go to a specific character

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.