Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Home_Work
- {
- class Program
- {
- static void Main()
- {
- string userInput;
- string[] userInputWords;
- char[] separations = { ' ', '.', '!', '?', ','};
- int index = 1;
- Console.WriteLine("Введите любую строку: ");
- userInput = Console.ReadLine();
- userInputWords = userInput.Split(separations);
- Console.WriteLine("\nВаши слова:");
- foreach (string word in userInputWords)
- {
- if (word != "")
- {
- Console.WriteLine(index + ". " + word);
- index++;
- }
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment