package baekjoon;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
public class AplusB_5 {
public static void main(String[] args) throws IOException {
/*
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
입력
입력은 여러 개의 테스트 케이스로 이루어져 있다.
각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)
입력의 마지막에는 0 두 개가 들어온다.
출력
각 테스트 케이스마다 A+B를 출력한다.
입력 1 출력 1
1 1 2
2 3 5
3 4 7
9 8 17
5 2 7
0 0
*/
// solution1();
// solution2();
solution3();
}
// public static void solution1() {
// Scanner in = new Scanner(System.in);
//
//
// while (true) {
// int A = in.nextInt();
// int B = in.nextInt();
// if (A == 0 && B == 0) {
// break;
// }
// System.out.println(A + B);
// }
// }
// public static void solution2() throws IOException {
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// StringTokenizer st;
// StringBuilder sb = new StringBuilder();
//
// while(true) {
// st = new StringTokenizer(br.readLine(), " ");
// int A = Integer.parseInt(st.nextToken());
// int B = Integer.parseInt(st.nextToken());
//
// if (A == 0 && B == 0) {
// break;
// }
//
// sb.append(A + B).append("\n");
// }
//
// System.out.println(sb);
// }
public static void solution3() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
while (true) {
String str = br.readLine();
int A = str.charAt(0) - 48;
int B = str.charAt(2) - 48;
if (A == 0 && B == 0) {
break;
}
sb.append(A + B).append("\n");
}
System.out.println(sb);
}
}
백준알고리즘 코드
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
// solution1();
// solution2();
solution3();
}
// public static void solution1() {
// Scanner in = new Scanner(System.in);
//
//
// while (true) {
// int A = in.nextInt();
// int B = in.nextInt();
// if (A == 0 && B == 0) {
// break;
// }
// System.out.println(A + B);
// }
// }
// public static void solution2() throws IOException {
// BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
// StringTokenizer st;
// StringBuilder sb = new StringBuilder();
//
// while(true) {
// st = new StringTokenizer(br.readLine(), " ");
// int A = Integer.parseInt(st.nextToken());
// int B = Integer.parseInt(st.nextToken());
//
// if (A == 0 && B == 0) {
// break;
// }
//
// sb.append(A + B).append("\n");
// }
//
// System.out.println(sb);
// }
public static void solution3() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
while (true) {
String str = br.readLine();
int A = str.charAt(0) - 48;
int B = str.charAt(2) - 48;
if (A == 0 && B == 0) {
break;
}
sb.append(A + B).append("\n");
}
System.out.println(sb);
}
}