统计一个文本中有多少个英文单词 如何用c# 或js来实现
统计一个文本中有多少个英文单词 如何用c# 或js来实现
比如﹕   You  are good !  I  love  you !
统计: 一共有6个单词
一个字母:1个  I
二个字母:0
三个字母:3个  You  are you
四个字母:2个  good love
              
------解决方案--------------------string str = "You  are good !  I  love  you !";
            string[] array = str.Split(' ');
            string value = string.Empty;
            Console.WriteLine("统计:一共有" + array.Where(item => item.Length > 0 && item != "!").Count() + "个单词 ");
            var list1 = array.Where(item => item.Length == 1);
            array.Where(item => item.Length == 1);
            list1.ToList().ForEach(item => value = value + " " + item);
            Console.WriteLine("一个字母:" + list1.Count() + "个 " + value);
            value = string.Empty;
            var list2 = array.Where(item => item.Length == 2);
            list2.ToList().ForEach(item => value = value + " " + item);
            
            Console.WriteLine("二个字母:" + list2.Count() + "个 " + value);
            value = string.Empty;
            var list3 = array.Where(item => item.Length == 3);
            list3.ToList().ForEach(item => value = value + " " + item);
            Console.WriteLine("三个字母:" + list3.Count() + "个 " + value);
            value = string.Empty;
            var list4 = array.Where(item => item.Length == 4);
            list4.ToList().ForEach(item => valu