Algorithm/BOJ
[BOJ] 10173 니모를 찾아서
yeeendy
2023. 1. 12. 23:22
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 메서드
홍성헌님 블로그 참고