Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[김지원] A와B #251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions solution/BOJ_12904_A와_B/김지원.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {

public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuffer s = new StringBuffer(br.readLine());
StringBuffer t = new StringBuffer(br.readLine());

while(s.length() < t.length()) {
if(t.charAt(t.length()-1) == 'A') {
t.deleteCharAt(t.length()-1);
}else if(t.charAt(t.length()-1) == 'B'){
t.deleteCharAt(t.length()-1);
t.reverse();
}
}

if(s.toString().equals(t.toString())) {
System.out.println(1);
}else {
System.out.println(0);
}
}
}