import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Baek11720 {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int sum = 0;
String s = br.readLine();
if(s.length()==n) {
for(int i =0; i<s.length(); i++) {
sum += s.charAt(i)-'0'; //charAt예시
}
System.out.println(sum);
}
}
}
int[] arr; // -1 로 초기화 된 배열
String S = in.nextLine();
for(int i = 0; i < S.length(); i++){
char ch = S.charAt(i);
arr[ch - 'a'] = i;
}
위치 값을 다시 알파벳으로 바꾸는 방법
→ 해당 위치값 +65해준후 char로 형변환
System.out.println((char)(i + 65)); //i는 알파벳의 위치값
소문자를 대문자로로
대문자를 소문자로
알파벳갯수 26개
토큰수 세는 함수 st.countTokens() → asd asdfd asf dsa 이러면 토큰수4개
StringBuilder
StringBuilder sb = new StringBuilder();
sb.append("나는" + " ");
sb.append("정수");
System.out.println(sb);
출력 -> 나는 정수
append안에 다 모아서 한번에 출력