[SWEA] 1289. 원재의 메모리 복구하기(D3)
풀이
import java.util.Scanner;
import java.io.FileInputStream;
class Solution
{
	public static void main(String args[]) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		int T;
		T=sc.nextInt();
		for(int test_case = 1; test_case <= T; test_case++)
		{
			String original = sc.next();
			int[] token = new int[original.length()];
			for(int i = 0; i < original.length(); i++) {
				token[i] = original.charAt(i)-'0';
			}
			int count = token[0];
			
			for(int i = 1; i < token.length; i++) {
				if(token[i] != token[i-1])
					count++;
			}
			
			System.out.println("#"+test_case+" "+count);
		}
	}
}
                Author And Source
이 문제에 관하여([SWEA] 1289. 원재의 메모리 복구하기(D3)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@humblechoi/SWEA-1289.-원재의-메모리-복구하기D3저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)