Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main()
- {
- string shortestString = FindShortestString();
- Console.WriteLine("Shortest string: " + shortestString);
- Console.WriteLine(shortestString.Length);
- }
- static string FindShortestString()
- {
- string shortestString = null;
- for (int i = 0; i <= 9; i++)
- {
- for (int j = 0; j <= 9; j++)
- {
- for (int k = 0; k <= 9; k++)
- {
- for (int l = 0; l <= 9; l++)
- {
- string currentCombination = i.ToString() + j.ToString() + k.ToString() + l.ToString();
- shortestString += currentCombination;
- }
- }
- }
- }
- return shortestString;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement