모든 일상

C# 백준 1152번 문제 단어의 개수 본문

코딩 공부/C#

C# 백준 1152번 문제 단어의 개수

통통푸린 2022. 7. 26. 14:12
728x90
반응형

using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();

            string[] arr = str.Split();
            int cnt = 0;
            for (int i = 0; i<arr.Length; i++)
            {
                if (arr[i] != "")
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }      
    }
}

728x90
반응형

'코딩 공부 > C#' 카테고리의 다른 글

C# 백준 5622번 문제 다이얼  (0) 2022.07.26
C# 백준 2908번 문제 상수  (0) 2022.07.26
C# 백준 1157번 문제 단어 공부  (0) 2022.07.26
C# 백준 8958번 문제 OX퀴즈  (0) 2021.07.27
C# 백준 1546번 문제 평균  (0) 2021.07.23