본문 바로가기
알고리즘/백준 BOJ

[BOJ C#] 2711 오타맨 고창영

by 왹져박사 2023. 1. 12.
728x90
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2711
{
    class App
    {
        //생성자
        public App()
        {

            //boj 2711 오타맨 고창영 
            Dictionary<int, string> dic = new Dictionary<int, string>(){
                { 4, "MISSPELL" },
                { 1, "PROGRAMMING" },
                { 7, "CONTEST" },
                { 3, "BALLOON" },
            };

            //여기서부터 작성 ]
            foreach(KeyValuePair<int, string>pair in dic)
            {
                PrintValue(RemoveString(pair.Key, pair.Value));
            }


            //출력 
            //MISPELL
            //ROGRAMMING
            //CONTES
            //BALOON

        }
        private string RemoveString(int key, string value)
        {
            string fixedValue = value.Remove(key - 1, 1);
            return fixedValue;
        }
        private void PrintValue(string value)
        {
            Console.WriteLine(value);
        }
    }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _2711
{
    class Program
    {
        static void Main(string[] args)
        {
            new App();
        }
    }
}

728x90

'알고리즘 > 백준 BOJ' 카테고리의 다른 글

[BOJ C#] 10988 팰린드롬  (0) 2023.01.15
[BOJ C#] 1181 단어 정렬  (0) 2023.01.12
[BOJ C#] 10173 니모를 찾아서  (0) 2023.01.12
[BOJ C#] 4458 첫 글자를 대문자로  (0) 2023.01.12
[BOJ C#] 9086 문자열  (0) 2023.01.12