// Sample Solution
using System;
namespace NameGrab
{
class Program
{
static void Main(string[] args)
{
// User Name
string name = "Farhad Hesam Abbasi";
// Get first letter
int firstNamePosition = name.IndexOf("Farhad");
char firstLetter = name[firstNamePosition];
// Get last name
int lastNamePosition = name.IndexOf("Abbasi");
string lastName = name.Substring(lastNamePosition);
// Print results
Console.WriteLine($"{firstLetter}. {lastName}");
}
}
}
No comments:
Post a Comment