using System;
using System.Text;
namespace MainPrograms
{
class Program
{
static void Main(string[] args)
{
// Prompt the user for input
Console.WriteLine("please enter your Input String");
// Read the input from the console
string InputedString = Console.ReadLine();
// Convert the input string into character array
char[] InputedCharacters = InputedString.ToCharArray();
// Initialize a string builder object for the output
StringBuilder OutputString = new StringBuilder();
// Loop thru each character in the string array
foreach (var item in InputedCharacters)
{
// If the character is in uppercase
if (char.IsUpper(item))
{
// Append space
OutputString.Append(" ");
}
// Append every charcter to reform the output
OutputString.Append(item);
}
// Remove the space at the begining of the string
OutputString.Remove(0, 1);
// Print the output
Console.WriteLine("{0}", OutputString.ToString());
Console.ReadKey();
}
}
}
No comments:
Post a Comment