Skip to content

BOJ15886_내_선물을_받아줘2_실버3_권은홍 #36

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

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package study.baekjoon.week6.BOJ15886_내_선물을_받아줘2;
import java.util.Scanner;

public class BOJ15886_내_선물을_받아줘2_실버3_권은홍 {
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
scanner.nextLine(); // 엔터 소비
String[] mapArr = scanner.nextLine().split("");

String before = "E"; // 바로 전 자리 값
int result = 0; // 결과값
for(String x : mapArr)
{
if("E".equals(before) && "W".equals(x)) result++;
before = x;
}
System.out.println(result);
}
}