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