My Solution
using System;
using System.Linq;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
string s = Console.ReadLine();
char[] ss = s.ToCharArray();
string alphab = "abcdefghijklmnopqrstuvwxyz";
char[] alphabets = alphab.ToCharArray();
for (int i = 0; i < 26; i++)
{
int position = Array.IndexOf(ss, alphabets[i]);
Console.WriteLine(position);
}
}
}
}
Solution
using System;
using System.Text;
namespace Test1
{
public class Test
{
public static void Main(string[] args)
{
string input = Console.ReadLine();
StringBuilder sb = new StringBuilder();
for (char c = 'a'; c <= 'z'; c++)
{
sb.Append(input.IndexOf(c) + " ");
}
Console.WriteLine(sb);
}
}
}
댓글