[Meet time] internal push test-treasure Map-java Realization

Source: Internet
Author: User

Niuniu got a treasure map, follow the instructions of the treasure map, cattle and cattle found a treasure box, possession of a box on the body, the organs will show two strings s and T, according to the ancient legend, cattle and cows need to answer each time t is a sub-sequence of S. Note that the subsequence is not required to be contiguous in the original string, such as the string ABC, and its subsequence has {empty string, A, B, C, AB, AC, BC, ABC} 8 kinds.

Input Description:
Each input contains a test case. Each test case contains two visible ASCII strings that do not contain spaces up to 10 in length.


Output Description:
The output line "Yes" or "No" indicates the result.

Input Example:
X.nowcoder.comooo

Output Example:
Yes

The following Java code in the cattle online AC through, I also got the NetEase interview notice, but not review of people can not interview!!!
1 ImportJava.util.Scanner;2  Public classMain {3      Public Staticstring issubstring (String s,string T) {4String ss=S;5String tt=T;6         if(S.length () <t.length () | | T.length () <0| | T.equals (NULL)|| S.length () >10| | T.length () >10) {7             return"No";8         }9         Ten         intI=0; One          for(; I<tt.length (); i++){ A             CharC=Tt.charat (i); -             intL =Ss.indexof (string.valueof (c)); - //System.out.println (l); the             if(l>=0&&l<s.length ()) { -SS = ss.substring (l+1); -}Else{ -                 return"No"; +             } -         } +         if(I ==t.length () &&ss.length () >=0) { A             return"Yes"; at}Else { -             return"No"; -         } -     } -  -      Public Static voidMain (string[] args) { in         //TODO auto-generated Method Stub -Scanner in =NewScanner (system.in); toString Str =in.nextline (); +String T =in.nextline (); - System.out.println (issubstring (STR, T)); the //System.out.println (issubstring ("Jkk", "")); * //System.out.println (Issubstring ("", "O")); $ //System.out.println (issubstring ("SB", "S"));Panax Notoginseng //System.out.println (issubstring ("SB", "BB")); - //System.out.println (issubstring ("XXXSBBBBBB", "SSB")); the //System.out.println (issubstring ("xxxsbbbbbb", "XB")); + //System.out.println (issubstring ("xxxmmmsbb0", "xmb0")); A //System.out.println (issubstring ("xxx", "xxxx")); the     } +  -}

[Meet time] internal push test-treasure Map-java Realization

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.