Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
little problem
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
// 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)) { // if program comes here then Input string is not valid } if (str4.Substring(1, 1) != str3.Substring(0, 1)) { // if program comes here then Input string is not valid } if (str4.Substring(str4.Length - 1, 1) != str2.Substring(0, 1)) { // if program comes here then 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) { // if program comes here then 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) { // if program comes here then Input string is not valid } //final place. //If can come here without any input string error, then input string is valid } } }
Show compiler warnings
[
+
]
Show input
Compilation time: 0,14 sec, absolute running time: 0,09 sec, cpu time: 0,08 sec, average memory usage: 17 Mb, average nr of threads: 3
edit mode
|
history
|
discussion