코딩테스트/[C#] 프로그래머스

[프로그래머스 | C# | Lv.0] 영어가 싫어요

냠냠쿠 2023. 9. 17. 21:46
728x90

https://school.programmers.co.kr/learn/courses/30/lessons/120894

📝 나의 풀이

using System;

public class Solution {
    public long solution(string numbers) {
        
        string[] num = new string[]{"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
        
        for(int i=0; i<num.Length; i++){
            numbers = numbers.Replace(num[i], i.ToString());
        }
        
        return long.Parse(numbers);
    }
}
728x90