using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Study11
{
class App
{
//생성자
public App()
{
string[] arr = {
"Marlin names this last egg Nemo, a name that Coral liked.",
"While attempting to save nemo, Marlin meets Dory,",
"a good-hearted and optimistic regal blue tang with short-term memory loss.",
"Upon leaving the East Australian Current,(888*%$^&%0928375)Marlin and Dory",
"NEMO leaves for school and Marlin watches NeMo swim away."
};
//여기서부터 작성 하세요
for (int i = 0; i < arr.Length; i++)
{
string str = arr[i].ToLower(); //전체 소문자화하여 글자 체크
if (str.Contains("nemo"))
{
Console.WriteLine("Found");
}
else
{
Console.WriteLine("Missing");
}
}
//출력
//Found
//Found
//Missing
//Missing
//Found
}
}
}
ToLower 메서드를 활용한 방식이 참신하다.
해당 키워드를 찾기에 유용한 방식이다.
Contain 메서드
홍성헌님 블로그 참고
'Algorithm > BOJ' 카테고리의 다른 글
[BOJ] 11720 숫자의 합 (0) | 2023.01.15 |
---|---|
[BOJ] 1120 문자열(미완) (0) | 2023.01.13 |
[BOJ] 4458 첫 글자를 대문자로 (0) | 2023.01.12 |
[BOJ] 2711 오타맨 고창영 (0) | 2023.01.12 |
[BOJ] 9086 문자열 (0) | 2023.01.12 |