Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Reverse And Shift Char in String
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
//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.Globalization; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { CultureInfo ci = new CultureInfo("hi-IN"); var numbers = new List<string>(); numbers.Add(11223344556677889900.ToString("N0",ci)); numbers.Add(10000000000000000000.ToString("N0",ci)); for(var i = 0; i < numbers.Count; i++){ numbers[i] = ShiftString(numbers[i]); Console.WriteLine((numbers[i])); } Console.Write(ReverseString(numbers[0])); } public static string ShiftString(string t) { string result = string.Empty; bool comma = false; foreach(var chr in t){ if(chr == ','){ comma = true; continue; } result += chr+(comma ? "," : ""); comma = false; } return result; } ///Recursion method; simple and regular performance for small strings public static string ReverseString(string str) { if (str.Length <= 1) return str; else return ReverseString(str.Substring(1)) +str[0]; } } }
Show compiler warnings
[
+
]
Show input
Compilation time: 0,17 sec, absolute running time: 0,11 sec, cpu time: 0,09 sec, average memory usage: 12 Mb, average nr of threads: 3
edit mode
|
history
|
discussion
11,22,33,44,55,66,77,88,99,00 10,00,00,00,00,00,00,00,00,00 00,99,88,77,66,55,44,33,22,11