C# 打印句子中每个单词的第一个字母

C# 打印句子中每个单词的第一个字母,c#,C#,我需要一个简单的C语言解决这个问题 输入:任何人都可以跳舞 输出:ABCD检查以下内容: string inputString = "Another One Bites The Dust And Another One Down"; string[] split = inputString.Split(); foreach (string s in split) { Console.Write(s.Substring(0,1)); } string s = new string("An

我需要一个简单的C语言解决这个问题

输入:任何人都可以跳舞

输出:ABCD

检查以下内容:

string inputString = "Another One Bites The Dust And Another One Down";
string[] split = inputString.Split();
foreach (string s in split)
{
    Console.Write(s.Substring(0,1));
}
string s = new string("Any Body Can Dance"
                     .Split(' ')
                     .Select(x => x.First())
                     .ToArray());
Console.WriteLine(s);

另一个问题是,你能不能让我的作品成为一个简单的问题。选择d=>d.First.ToArray。如果使用s,编译器将抛出错误,因为s已定义+1用于像字符串[]split=inputString.split这样使用万能的LINQput;不要使用下面提到的字符串拆分[]=inputString.split;