취미로 음악을 하는 개발자

[java] codeforce ROUND #559 Div.2 (1) 본문

공대인/Codeforce

[java] codeforce ROUND #559 Div.2 (1)

영월특별시 2019. 5. 13. 01:39
728x90




import java.util.*;

public class Main {

public static void main(String[] args) {

// TODO Auto-generated method stub

Scanner in = new Scanner(System.in);

int n = in.nextInt();

in.nextLine();

String str = in.nextLine();

int count = 0;

for (int i = 0; i < str.length(); i++) {

if (str.charAt(i) == '+')

count++;

else {

if (count != 0)

count--;

}

}

System.out.println(count);

}

}


http://codeforces.com/contest/1159/problem/A



'공대인 > Codeforce' 카테고리의 다른 글

[java] codeforce ROUND #559 Div.2 (2)  (0) 2019.05.13
Comments