这几天面试的时候,好几家都让写了这个算法,例如:输入 i an a boy,输出boy a am i。
第一种,使用库函数
using System;
using System.Collections.Generic;
using System.Text;
using ConsoleApp.Inherit;

namespace ConApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string input=Console.ReadLine();
            input = input.Trim();
            string[] output = input.Split(new char[] { ' ' });

            for (int i = output.Length-1; i >= 0; i--)
            {
                Console.WriteLine(output[i].ToString());
            }

            Console.ReadLine();
        }
    }
}
第二种,不使用库函数

相关文章:

  • 2021-11-19
  • 2021-06-29
  • 2022-12-23
  • 2022-01-04
  • 2022-12-23
  • 2021-09-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案