Skip to content

Commit

Permalink
#9 6550번 부분 문자열
Browse files Browse the repository at this point in the history
  • Loading branch information
leejw-lu committed Dec 24, 2023
1 parent 729753f commit ae5bad7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions 문자열/부분_문자열.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package 문자열;
import java.io.*;
import java.util.*;
//6550번 부분 문자열
public class 부분_문자열 {
public static void main(String[] args) throws IOException{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
String str, s, t;
int idx;

while (true) {
str=br.readLine();
if (str==null) break;

st= new StringTokenizer(str);
s= st.nextToken();
t= st.nextToken();

idx=0; //초기화
for (int i=0;i<t.length();i++){
if (s.charAt(idx)==t.charAt(i)) idx++;
if (idx==s.length()) break;
}

if (idx==s.length()) System.out.println("Yes");
else System.out.println("No");
}

}

}

0 comments on commit ae5bad7

Please sign in to comment.