Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
c# problem
// Hi, I have a little program that validate any 25 charchter input string against some //substring and other rules. for example if we provide a string "ABCDEFGHIJKLMNOPQRSTUVWXY" //it will run through program and check if it's validating aginst its rules. //if this string can bypass all the rules then it's valid string. //this is like checking licence key in software. Studying this program we needs to create a //new program that automattically generate 25 charchtater strings that passes this program. //Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string left =""; string right =""; string temp =""; int num; string str5 = ""; string str6 = ""; string st1 = ""; string st2 = ""; string st3 = ""; int num2 = 0; string str = "ABCDEFGHIJKLMNOPQRSTUVWXY"; //MAIN INPUT STRING WE PROVIDE string str2 = str.Substring(0, 3) + str.Substring(5, 2) + str.Substring(8, 1) + str.Substring(13, 3) + str.Substring(0x12, 1); string str3 = str.Substring(3, 2) + str.Substring(7, 1) + str.Substring(9, 4) + str.Substring(0x10, 2) + str.Substring(0x13, 1); string str4 = str.Substring(str.Length - 5, 5); if (str4.Substring(0, 1) != str2.Substring(4, 1)) { // Input string is not valid } if (str4.Substring(1, 1) != str3.Substring(0, 1)) { // Input string is not valid } if (str4.Substring(str4.Length - 1, 1) != str2.Substring(0, 1)) { // Input string is not valid } for (num = 0; num < str3.Length; num++) { str5 = str5 + Convert.ToString((int) (Convert.ToChar(str3.Substring(num, 1)) - '0')).Substring(Convert.ToString((int) (Convert.ToChar(str3.Substring(num, 1)) - '0')).Length - 1, 1); } for (num = 0; num < str2.Length; num++) { str6 = str6 + Convert.ToString((int) Convert.ToChar(str2.Substring(num, 1))).Substring(Convert.ToString((int) Convert.ToChar(str2.Substring(num, 1))).Length - 1, 1); } if (str5 != str6) { // Input string is not valid } int num3 = 0; string str12 = ""; for (num = 0; num < str3.Length; num++) { num3 = Convert.ToChar(str3.Substring(num, 1)); str12 = Convert.ToString((int) (Convert.ToChar(str3.Substring(num, 1)) - '0')).Substring(Convert.ToString((int) (Convert.ToChar(str3.Substring(num, 1)) - '0')).Length - 1, 1); num2 += Convert.ToInt32(str12); } str5 = num2.ToString(); str4 = str4.Substring(2, 2); str4 = Convert.ToString((int) (Convert.ToChar(str4.Substring(0, 1)) - '0')).Substring(Convert.ToString((int) (Convert.ToChar(str4.Substring(0, 1)) - '0')).Length - 1, 1) + Convert.ToString((int) (Convert.ToChar(str4.Substring(1, 1)) - '0')).Substring(Convert.ToString((int) (Convert.ToChar(str4.Substring(1, 1)) - '0')).Length - 1, 1); if (str5 != str4) { // Input string is not valid } //If can come here without any input string error, then input string is valid } } }
run
|
edit
|
history
|
help
0
Decimal separator diff
Problem: fb_series
Method overriding
to get distinct of the given array with each items occurrence count._1
Simple Enum Parsing
Dependency Injection - with class
Par ou ímpar input
test examen
subtração
Việc Làm Bắc Ninh