Skrip yang menampilkan skrip yang mencetak input yang diberikan

29

Tulis sepotong kode yang mengambil string sebagai input, dan mengeluarkan sepotong kode dalam bahasa yang sama yang, ketika dijalankan, akan menampilkan string input awal.

Itu harus dapat menangani kombinasi karakter AZ, az, dan 0-9.

Contoh dengan Python:

import sys
print "print('" + sys.argv[1]  + "')"

Diberikan masukan dari testing123, itu akan kembali print('testing123').

Karena ini adalah , jawaban terpendek dalam byte akan menang.

Kuarsa
sumber
Bisakah itu menjadi fungsi?
totallyhuman
@manatwork (S) dia baru saja mengeditnya.
NoOneIsHere
Haruskah input menjadi string? Atau mungkinkah bilangan bulat?
Shaggy
Harus dapat menangani input bilangan bulat dan string.
Quartzic
2
Bisakah kita menampilkan fungsi sesuai defaut pada meta?
JAD

Jawaban:

28

pl , 0 byte

Kode:

Cobalah online!

Penjelasan:

Program kosong di pl hanyalah sebuah program cat, menghasilkan keluaran yang sama persis dengan input.

Dalam pl, semua karakter ASCII pada dasarnya adalah variabel, tetapi ketika variabel tidak ada (belum), pl mengasumsikan bahwa mereka adalah bagian dari sebuah string.

Adnan
sumber
3
Saya tahu ada bahasa seperti ini, tidak dapat menemukannya :(
Stephen
2
Dalam nada yang sama, lihat Cat, yang merupakan bahasa yang ditafsirkan seperti Python. Sebagian besar distro Linux modern dilengkapi dengan catjuru bahasa. ;)
Quuxplusone
1
Solusi ini juga berfungsi untuk /// jika Anda menganggap input ditambahkan ke kode sumber program (karena /// tidak memiliki mekanisme untuk input). /// adalah salah satu dari banyak bahasa (saya pikir) di mana karakter alfanumerik pada awal program hanyalah output.
Tanner Swett
6
Bisakah Anda memposting versi yang tidak di-serigala? ;)
maxathousand
17

brainfuck , 56 55 33 byte

1 byte disimpan berkat Gravitron, dan 22 byte disimpan berkat Jo King!

--[>+<++++++],[[->.<]>+++.--.-<,]

Cobalah online!

Keluaran membutuhkan juru bahasa yang membungkus kekurangan memori dan memiliki EOI = 0. TIO memiliki penerjemah seperti itu.

Penjelasan

--[>+<++++++]Menginisialisasi rekaman itu dengan satu +.

Input loop:

,[[->.<]>+++.--.-<,]
,                     take input
 [                ,]  while input is nonzero:
  [->.<]                  output `+` input times
        >+++.             output `.` (`+` + 3)
             --.          output `,` (`.` - 2)
                -<        restore `+` and move back to input

Solusi lain

Setiap baris adalah solusinya sendiri.

+++[>+++++<-]>[>++++>+++<<-]>>-->,[[-<.>]<+++.---<.>>,]
--[>+<++++++],[[->.<]>+++.++++++++++++++++.-------------------<,]
++++++++++[>++++++>++++>++++<<<-]>>+++>++++++>,[[-<<.>>]<.<<.>>>,]
++++++++++[>++++++>++++>++++<<<-]>++>+++>++++++>,[[-<<.>>]<.<<.>>>,]
Conor O'Brien
sumber
1
+1. Saya tidak tahu Brainfuck, tapi saya tidak bisa membayangkan mencoba menyelesaikan masalah seperti ini dengannya.
Jakob
Anda dapat menyimpan 1 byte dengan mengganti +++++++++++++++dengan +++[>+++++<-]>(Dari konstanta brainfuck )
Graviton
@Graviton Oh, keren, terima kasih
Conor O'Brien
Anda tidak menggantinya dalam penjelasan
Destructible Lemon
4
Anda tidak tahu Brainfuck? Saya akan mengajari Anda dalam satu komentar! Kita mulai pada kaset 0's, dengan pointer ke nilai. +menambah nilai, -mengurangi nilai, >menggerakkan penunjuk ke kanan, <menggerakkan penunjuk ke kiri, ,membaca input ke penunjuk sebagai karakter ASCII, .mengeluarkan nilai penunjuk sebagai karakter ASCII, [memulai perulangan, dan ]melompat ke yang sesuai [jika nilai pointer tidak 0. Saya buruk dalam menjelaskan, tapi itulah bagaimana Brainfuck mudah. Dan Conor golf yang bagus!
Zacharý
13

Mornington Crescent , 27640 bytes

Take Northern Line to Moorgate
Take Circle Line to Moorgate
Take Circle Line to Westminster
Take Circle Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Barbican
Take Circle Line to Victoria
Take Circle Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Bayswater
Take District Line to Barons Court
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Cannon Street
Take Circle Line to Moorgate
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Barking
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Bakerloo Line to Paddington
Take Circle Line to Royal Oak
Take Circle Line to Tower Hill
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Bank
Take Circle Line to Baker Street
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Baker Street
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Liverpool Street
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take District Line to Gunnersbury
Take District Line to Upminster
Take District Line to East Ham
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Sloane Square
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take Circle Line to Cannon Street
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to East Ham
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Plaistow
Take District Line to Mile End
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Barking
Take District Line to Bank
Take District Line to Barking
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Wood Lane
Take Circle Line to Liverpool Street
Take Circle Line to Bank
Take Circle Line to Liverpool Street
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take District Line to Barking
Take District Line to Bank
Take District Line to Barking
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Dagenham East
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Victoria
Take Circle Line to Bank
Take Circle Line to Victoria
Take Circle Line to Hammersmith
Take District Line to Mile End
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Upminster
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take District Line to Elm Park
Take District Line to Bank
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Bank
Take Central Line to Northolt
Take Central Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Barons Court
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Wimbledon
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Mile End
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Baker Street
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Bakerloo Line to Waterloo
Take Northern Line to Bank
Take Circle Line to Bank
Take Central Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Blackfriars
Take Circle Line to Bank
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Paddington
Take Circle Line to Bank
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Victoria
Take Circle Line to Wood Lane
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take Circle Line to Paddington
Take Circle Line to Victoria
Take Circle Line to Victoria
Take Victoria Line to Euston
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Wood Lane
Take Circle Line to Paddington
Take Circle Line to Bank
Take Central Line to Northolt
Take Central Line to Bank
Take District Line to Southfields
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Baker Street
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Ravenscourt Park
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Upminster
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Bank
Take Northern Line to Old Street
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take District Line to Mile End
Take Central Line to Theydon Bois
Take Central Line to Mile End
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Old Street
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Acton Town
Take Piccadilly Line to Cockfosters
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Wood Lane
Take Circle Line to Paddington
Take Circle Line to Wood Lane
Take Circle Line to Bank
Take District Line to Elm Park
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bayswater
Take Circle Line to Paddington
Take Circle Line to Bayswater
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bayswater
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bayswater
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bayswater
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Barbican
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Barbican
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to East Ham
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take District Line to Elm Park
Take District Line to Bank
Take Central Line to Chancery Lane
Take Central Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Bank
Take District Line to Plaistow
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Bank
Take Circle Line to Farringdon
Take Circle Line to Bank
Take Circle Line to Bank
Take Central Line to Mile End
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Brent Cross
Take Northern Line to Bank
Take Circle Line to Bank
Take Central Line to Mile End
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Farringdon
Take Circle Line to Bank
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Farringdon
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Farringdon
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Southfields
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take District Line to Elm Park
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to Elm Park
Take District Line to Paddington
Take Circle Line to Blackfriars
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Royal Oak
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to Barons Court
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Blackfriars
Take Circle Line to Paddington
Take Circle Line to Blackfriars
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Royal Oak
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Farringdon
Take Circle Line to Paddington
Take Circle Line to Paddington
Take District Line to Southfields
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Embankment
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to East Ham
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take District Line to East Ham
Take District Line to Bank
Take District Line to Barking
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Barbican
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to West Ham
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take District Line to Barons Court
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Victoria
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Wood Lane
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Aldgate
Take Circle Line to Paddington
Take Circle Line to Aldgate
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take District Line to Barking
Take District Line to Paddington
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to Barking
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Moorgate
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Central Line to Chancery Lane
Take Central Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take District Line to Barking
Take District Line to Paddington
Take Circle Line to Westminster
Take Circle Line to Paddington
Take District Line to Plaistow
Take District Line to Bank
Take Circle Line to Moorgate
Take Circle Line to Hammersmith
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Bank
Take Circle Line to Paddington
Take Circle Line to Westminster
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take Circle Line to Aldgate
Take Circle Line to Temple
Take Circle Line to Hammersmith
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Bank
Take Circle Line to Westminster
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Tower Hill
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Temple
Take Circle Line to Bank
Take Circle Line to Bayswater
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bayswater
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Embankment
Take Circle Line to Hammersmith
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Embankment
Take Northern Line to Angel
Take Northern Line to Bank
Take Central Line to Marble Arch
Take Central Line to Bank
Take Circle Line to Bank
Take Circle Line to Westminster
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Mile End
Take Central Line to Bank
Take Circle Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Northern Line to Bank
Take Circle Line to Tower Hill
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take Circle Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take District Line to Upminster
Take District Line to Embankment
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Piccadilly Line to Bounds Green
Take Piccadilly Line to Hammersmith
Take Circle Line to Embankment
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take District Line to Acton Town
Take District Line to Acton Town
Take Piccadilly Line to Bounds Green
Take Piccadilly Line to Holborn
Take Central Line to Holborn
Take Central Line to Bank
Take Circle Line to Hammersmith
Take District Line to West Ham
Take District Line to Bank
Take Circle Line to Aldgate
Take Circle Line to Aldgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to King's Cross St. Pancras
Take Victoria Line to Seven Sisters
Take Victoria Line to Euston
Take Victoria Line to Euston
Take Northern Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Stepney Green
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Stepney Green
Take Hammersmith & City Line to Moorgate
Take Circle Line to Moorgate
Take Metropolitan Line to Chalfont & Latimer
Take Metropolitan Line to Moorgate
Take Circle Line to Moorgate
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Tower Hill
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take Piccadilly Line to Russell Square
Take Piccadilly Line to Russell Square
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Bank
Take District Line to East Ham
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take District Line to East Ham
Take District Line to Tower Hill
Take Circle Line to Bank
Take District Line to West Ham
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Angel
Take Northern Line to Bank
Take Circle Line to Moorgate
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Bank
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Barbican
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Moorgate
Take Circle Line to Bank
Take Northern Line to Morden
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take District Line to Mile End
Take District Line to Embankment
Take Northern Line to Kennington
Take Northern Line to Bank
Take Circle Line to Bank
Take Central Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Liverpool Street
Take Circle Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Aldgate
Take Metropolitan Line to Croxley
Take Metropolitan Line to Aldgate
Take Circle Line to Aldgate
Take Circle Line to Bank
Take Circle Line to Bank
Take District Line to Gunnersbury
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Hammersmith
Take District Line to Gunnersbury
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to West Brompton
Take District Line to Gunnersbury
Take District Line to Mile End
Take District Line to Acton Town
Take District Line to Mile End
Take District Line to Paddington
Take Circle Line to Paddington
Take Circle Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take District Line to Mile End
Take District Line to Acton Town
Take District Line to Acton Town
Take Piccadilly Line to Hounslow Central
Take Piccadilly Line to Acton Town
Take District Line to Acton Town
Take District Line to Mile End
Take District Line to Gunnersbury
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Gunnersbury
Take District Line to Paddington
Take Circle Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent

Cobalah online!

Penjelasan

Pertama, penyegaran cepat di Mornington Crescent:

  • setiap stasiun dapat memiliki string dengan panjang sembarang atau bigint
  • ada juga akumulator yang juga memegang string atau bigint
  • semua stasiun dimulai dengan namanya sendiri sebagai nilainya
  • pada awalnya, akumulator berisi input program Anda
  • setiap kali Anda pergi ke stasiun, nilai stasiun dan akumulator ditukar
  • beberapa stasiun khusus dan mengesampingkan perilaku ini
  • jalur yang Anda gunakan untuk sampai ke stasiun tidak masalah
  • Anda mulai di Mornington Crescent
  • untuk mengakhiri program, Anda pergi ke Mornington Crescent juga
  • pada akhirnya, nilai akumulator dicetak

Karena string pencetakan sulit (lihat program Mornington Crescent "Hello, World!" Karya Martin Ender ), kita akan membutuhkan template sederhana yang dapat digunakan untuk menghasilkan string umum. Karena panjang dari program yang dihasilkan tidak masalah, saya telah menetapkan ini:

Take Northern Line to Bank
Take Northern Line to Bank
Take District Line to Paddington

Kita perlu membuat setiap karakter secara terpisah dan menggabungkannya, karena pendekatan substring yang digunakan oleh Martin jauh lebih sulit untuk diterapkan dalam kasus umum. Paddington adalah stasiun yang melakukan penggabungan string. Ketika Anda tiba di Paddington, hal berikut terjadi:

accumulator, paddington = paddington + accumulator, accumulator

Perilaku ini digunakan untuk menginisialisasi Paddington ke string kosong yang dianggap sebagai input.

Take District Line to Victoria
Take Victoria Line to Seven Sisters
Take Victoria Line to Euston
Take Victoria Line to Euston
Take Northern Line to Bank

Pergi ke Seven Sisters, yang menetapkan akumulator ke 7, dan menyimpannya di Bank. Bank adalah satu-satunya cara untuk menyalin nilai - Hammersmith adalah salinan nilai Bank yang dapat dibaca.

Take District Line to Hammersmith
Take District Line to Cannon Street
Take District Line to Hammersmith
Take District Line to Cannon Street
Take District Line to Bank

Bagilah 7 dengan 7 untuk mendapatkan 1, pembagi semua nilai ASCII yang perlu kita dukung.

Take District Line to Hammersmith
Take District Line to Upminster

Untuk setiap karakter, mulailah dengan menyalin 1 ke Upminster.

Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Upminster

Tambahkan lebih banyak yang diperlukan.

Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Bank
Take District Line to Bank
Take Northern Line to Charing Cross
Take Northern Line to Charing Cross
Take Bakerloo Line to Paddington
Take Bakerloo Line to Paddington
Take Bakerloo Line to Charing Cross
Take Northern Line to Embankment

Selesaikan dengan pergi ke Upminster hanya sekali, untuk menyimpan nilai baru di akumulator alih-alih menyimpannya lagi. Bawa ke Charing Cross untuk mengubah nilai ASCII menjadi karakter dan menambahkannya ke string. Dua baris terakhir ada karena saya salah membaca spesifikasinya, jadi saya akan berhenti di sini dan menghentikan program saya terlebih dahulu.

NieDzejkob
sumber
(Penafian: Saya baru saja belajar bahasa ini) Tentang pendekatan yang persis sama yang dapat saya pikirkan (7/7 = 1). Tetapi mengapa Anda tidak mengatur Upminister hanya sekali di awal program?
user202729
@ user202729 Bagaimana cara kerjanya? / Fakta menarik: baris berulang Take District Line to Upminstermenghitung urutan fibonacci
NieDzejkob
Sepertinya saya salah mengerti spec . Tapi itulah yang tertulis di sana ... seseorang perlu mengedit wiki.
user202729
7

Jelly , 1 byte

Woo builtin!

Builtin yang unevals input.

Cobalah online!

Yang lebih menarik:

⁾“”j

Bergabung dengan string "" "" oleh input.

Cobalah online!

fireflame241
sumber
1
Untuk yang kedua saya pikir Anda bisa melakukannya ”“;untuk -1.
Erik the Outgolfer
7

Arang, 1 byte

θ

Secara default, serangkaian karakter ASCII .. ~hanya mencetak sendiri, jadi tetap mencetak input.

Neil
sumber
Saya akan menambahkan jawaban yang sama ini. :-)
Charlie
@CarlosAlejo Yah itu bukan seolah-olah ada jawaban yang berbeda ...
Neil
2
Nah ada : P
ASCII-satunya
@ Sentuhan khusus ASCII!
Neil
6

C (gcc) , 89 87 58 56 byte

Disimpan dua byte berkat Jakob!

main(a,c)char**c;{printf("main(){puts(\"%s\");}",c[1]);}

Cobalah online!

Conor O'Brien
sumber
"Itu harus dapat menangani kombinasi karakter AZ, az, dan 0-9." Anda mungkin ingin pergi dengan strategi lolos setelah semua.
Jakob
@ Jakob ya saya baru saja membaca itu: /, terima kasih
Conor O'Brien
Saya juga baru saja selesai menulis regex escaper untuk solusi Java ketika saya membaca itu. Gelandangan.
Jakob
@ Jakob Ya, sama untuk saya, tetapi dengan eacal. RIP
Conor O'Brien
Anda dapat menggunakan putsprogram tercetak untuk menghemat 2 byte, bukan? Atau itu masalah yang ditambahkan baris baru?
Jakob
5

Japt , 2 byte

iQ

Cobalah online!

iadalah fungsi yang menyisipkan string yang ditentukan pada indeks yang ditentukan ke dalam input. Qadalah variabel yang default ke tanda kutip ", dan karena tidak ada indeks yang diberikan, ini default ke 0. Hasil akhirnya adalah tanda kutip yang disisipkan di awal string, yang langsung selesai saat berjalan.

Ini berfungsi pada string yang berisi apa pun kecuali ",, {atau \, meskipun tentu saja string dijamin terdiri dari karakter alfanumerik jadi ini tidak masalah.

Produksi ETH
sumber
4

Python 2 , 22 byte

print'print%r'%input()

Cobalah online!

benar-benar manusiawi
sumber
2
Solusi 22 byte alternatif adalah print'print'+`input()`.
notjagan
Ini tidak akan berhasil. inputdi Python 2 setara dengan eval(raw_input()). Jadi itu harus menjadi ekspresi pythonic agar bisa berfungsi.
Zizouz212
Ya, itu diizinkan. --- Biarkan aku menemukan meta yang sesuai ...--- Aha, menemukannya.
totallyhuman
4
21 byte
LyricLy
4

MATLAB / Oktaf , 15 byte

@(t)['disp ',t]

Cobalah online!

Saya benar-benar mengabaikan fakta bahwa program hanya perlu menangani karakter alfanumerik, atau, yang penting, tidak perlu menangani karakter ruang. Ini berarti kita dapat menggunakan sintaks 'perintah', yang menggunakan byte lebih sedikit secara signifikan.

MATLAB, 27 byte

Untuk kelengkapan, inilah versi yang dapat menangani input sewenang-wenang:

@(t)['disp(',mat2str(t),41]

Menentukan fungsi anonim yang mengambil string t, dan mengubahnya menjadi program. Anehnya, ini tidak berfungsi di Octave, yang tampaknya memiliki gagasan berbeda tentang apa yang mat2strharus dilakukan.

Sanchises
sumber
Saya tidak bisa menguji ini, tetapi saya pikir: @(t)['disp ',mat2str(t)]harus bekerja ...?
Stewie Griffin
@StewieGriffin Itu tidak berfungsi karena mat2strmenambahkan tanda kutip, yang tidak perlu dalam sintaksis perintah. Saya memiliki sintaks fungsi dikombinasikan dengan mat2struntuk menangani spasi di input, tetapi pada membaca ulang tantangan, itu sebenarnya tidak perlu, memotong bytecount hampir menjadi setengahnya. Terima kasih!
Sanchises
Saya pikir tanda kutip diperlukan jika ada spasi di input tetapi saya mungkin salah. Saya tidak memperhatikan bahwa inputnya hanya alfanumerik ...
Stewie Griffin
Seperti ini (ungolfed).
Stewie Griffin
@StewieGriffin Anda benar, saya salah menilai cara perintah sintaks bekerja. Namun, sintaks perintah tampaknya penuh kejutan: Coba online!
Sanchises
3

Befunge-98 (FBBI) , 21 16 12 byte

-5 byte terima kasih kepada NieDzejkob
-4 byte terima kasih kepada Jo King

#,~'',,',,'@

Cobalah online!

Output 't,'e,'s,'t,@untuk inputtest

Bagaimana?

Awalnya pointer bergerak ke Timur:

#,           # skips the next instruction
  ~          push a byte of input
   '',       push ' and print it
      ,      print the byte of input
       ',,   push , and print it 
          '@ push @ to the stack

Jika tidak ada lagi input yang tersisa, ~balikkan arah pointer:

 ,           print @
#            skip nothing
           @ terminate
ovs
sumber
3

Emojicode , 88 byte

🐖😍➡️🔡🍇🍎🍪🔤🏁🍇😀❌🔤🔤🐕🔤❌🔤🍉🔤🍪🍉

Cobalah online!

Memasukkan:

anyString

Keluaran:

🏁🍇😀🔤anyString🔤🍉

Output Skrip:

anyString
X1M4L
sumber
2

QBIC , 7 byte

?@?@`+;

Penjelasan

?           PRINT on the screen
 @  `       a literal
  ?@         question mark and at
     +;     and append the input

Contoh dijalankan

Command line: lala
?@lala

Outputnya adalah string literal yang berisi input, didahului dengan PRINTperintah.

steenbergh
sumber
2

Batch 11 byte

Saya yakin ada yang jauh untuk membuatnya lebih kecil, tetapi ini cukup kecil.

set/p=echo 

Rinciannya:

set             ::Define new variable
   /p           ::Create prompt
     =          ::Define a variable in prompt
      echo      ::Prompt begins with 'echo '

Dalam Bahasa Inggris:

Pengguna diminta input dengan frasa terkemuka echo. Kemudian pengguna dapat mengetikkan apa saja, dan program berakhir (misalnya; echo hello world!). Ini meninggalkan kita dengan program yang ketika dijalankan, akan menampilkan hello world!.

Ya, ruang putih seharusnya ada di sana

Graviton
sumber
Saya tidak tahu batch (dan ini dari dulu), tetapi ini terlihat salah. Bukankah echoporsinya akan digaungkan ke konsol dan bukan output program?
Jakob
@ Jakob ternyata tidak, itu pada dasarnya secara fungsional setara dengan contoh python yang diberikan dalam tantangan awal.
Graviton
Ups - maksud saya adalah bahwa saya ragu program menampilkan teks yang diketik pengguna. Itu mungkin hanya bergema ke konsol, bukan?
Jakob
@Jakob Right, yang setara dengan pencetakan. Contoh ini mencetak fungsi cetak sementara milik saya menggema fungsi gema.
Graviton
OK, tapi contohnya mencetak seluruh program ke standar keluar. Program Anda hanya mencetak echo ke standar keluar. Bahkan, (saya berasumsi) jika input berasal dari file atau pipa, yang Anda lihat hanyalah prompt. Apakah output semacam itu diizinkan?
Jakob
2

V, 2 byte

ii

Di Vim, iperubahan ke mode penyisipan dan memungkinkan penyisipan teks. Dalam hal ini, itu hanya menyisipkan idi depan teks input (untuk membuat program kedua). V kompatibel dengan Vim, tetapi menambahkan implisit <esc>ke akhir program, jadi saya tidak perlu khawatir tentang hal itu di sini.

nmjcman101
sumber
2

PowerShell, 9 Bytes

"'$args'"

Kutipan tunggal atau ganda dalam PowerShell dapat digunakan untuk mengandung string, tetapi hanya tanda kutip ganda yang memungkinkan ekspansi variabel.

dengan input fooini akan menampilkan 'foo'yang merupakan program PowerShell yang valid yang menampilkanfoo

colsw
sumber
2

Secara kubik , 87 byte

U3D1R3L1F3B1U1D3~:7+1(-1@3(-1%1)6:1+3111@6%1-31111+004@6:1+11111%6:1+45@6:1-1%6~:7+1)6 

Cobalah online!

Port jawaban saya di sini . Sudah ada tantangan untuk mengambil input dan output kode Cubically yang menghasilkan input itu, dan saya punya jawaban di Cubically jadi ... untung?

Kamil Drakari
sumber
Simpan beberapa byte - hapus argumen dari %6s dan @6s; mereka sekarang dapat dipanggil secara implisit. (Anda juga dapat melakukannya pada jawaban Anda di utas cubifier.)
MD XF
2

D, 92 89 byte

void main(){import std.stdio;write(`void main(){import std.stdio;"`~readln~`".write;}`);}

Cobalah online!

Zacharý
sumber
2

Python 2 , 17 byte

'print%r'.__mod__

Cobalah online!

ovs
sumber
Ini gagal untuk1
NoOneIsHere
2
@NoOneIsHere tantangannya membutuhkan untuk mengambil string sebagai input. Jika Anda beralih '1'ke fungsi dengan benar outputprint'1'
ovs
Oh maafkan saya. Saya tidak memperhatikan itu.
NoOneIsHere
1

SOGL V0.12 , 2 byte

$+

Coba Di Sini! (mengharapkan input pada stack sehingga ,ditambahkan untuk kemudahan penggunaan)

$mendorong , +bergabung setelah input pada stack.

dzaima
sumber
Anda dapat menggunakan `" `untuk"
NoOneIsHere
@NoOneIsHere yeah, itu masuk akal .. Digunakan di tempat lain kecuali di mana itu yang paling berguna .-.
dzaima
1

Perl 6 , 19 byte

say "say "~get.perl

Cobalah

Ini harus bekerja untuk input Unicode apa pun di NFC

Brad Gilbert b2gills
sumber
Bisakah Anda menghapus ruang?
NoOneIsHere
@NoOneIsHere Menghapus spasi akan menghasilkan dua istilah dalam kesalahan baris. Perl 6 memiliki spasi putih yang signifikan, tetapi hanya signifikan karena harus ada di sana, atau tidak harus ada di sana. (ada beberapa cara untuk memilih keluar dari keduanya)
Brad Gilbert b2gills
1

8 , 34 37 byte

Kode

: f >s "\"" tuck s:+ s:+ " ." s:+ . ;

Contoh

ok> "Print 42" f
"Print 42" .
ok> "Print 42" .
Print 42
Kekacauan Manor
sumber
1

PHP , 12 byte

<?=$argv[1];

Cobalah online!

Ini harus dijalankan dari baris perintah dengan input sebagai argumen parameter. Dan ya, itu hanya menghasilkan string input - tapi itu PHP yang valid: apa pun di luar<?php ?> pembatas adalah output yang tidak diproses.

Berikut ini skrip yang dihasilkan oleh input 'testing123' yang sedang beraksi sebagai demonstrasi: Coba online!

WebSmithery
sumber
1
ini tidak akan berfungsi dengan baik jika string input berisi <?php, ingatkan Anda;)
Andrea
@Andrea Baca pertanyaan: "Ia harus dapat menangani kombinasi karakter AZ, az, dan 0-9." Jadi '<? Php' adalah input yang tidak valid ...
WebSmithery
1
aw, itu terlalu mudah :(
Andrea
1

MATL , 2 byte

&D

Cobalah online!

Cukup membungkus string dengan menggunakan tanda kutip &D, yang setara dengan MATL dengan MATLAB mat2str, sebuah fungsi yang khusus dibuat untuk membuat sesuatu yang, ketika evalakan, memberikan matriks asli (atau dalam hal ini, string).

'Program' yang dihasilkan hanyalah string input yang dibungkus dengan tanda kutip, yang dengan demikian didorong pada stack, dan ditampilkan secara implisit.

Sanchises
sumber
1

eacal , 38 byte

strap string put string 
put strap arg

Cobalah online!

Cukup tambahkan string put stringke string memori, lalu tambahkan argumen, yang dicetak.

Conor O'Brien
sumber
1

Batch, 14 byte

@echo @echo(%*

Bekerja untuk karakter khusus juga jika mereka dikutip menggunakan "s daripada ^.

Neil
sumber
Mungkin @echo.@echo.%*akan lebih benar? Masukan bisa berpotensi kosong.
Conor O'Brien
@ ConorO'Brien Yah saya tidak perlu yang pertama .karena itu tidak pernah kosong, dan saya menggunakan (untuk kasus kedua karena itu lebih dapat diandalkan daripada ., tapi terima kasih atas sarannya!
Neil
np! Saya suka simetri antara @echo.s lol
Conor O'Brien
1

Ly , 14 byte

"\""&i"\"&o"&o

Cobalah online!

Penjelasan

"\""&i"\"&o"&o

"\""           # push `"`
    &i         # take input
      "\"&o"   # push `"&o`
            &o # output stack
               # test -> "test"&o
               # "test"&o = push "test" and output stack
Lirik
sumber
1

Brain-Flak , 92 68 byte

-22 byte berkat Wheat Wizard

Termasuk +2 untuk -cr

{<>(((((()()()()()){}){}){})())<>{({}[()])<>((({}[()])()))<>}{}}<>

Cobalah online!

# For every character
{

   # Put ")(" on the off stack
   <>(((((()()()()()){}){}){})())<>

   # for 0 to the ASCII value of this character
   {({}[()])

      # Replace the ")" with "(" and add "))"
      <>((({}[()])()))<>

   # End for
   }{}

# end for and switch to the off stack for printing (in reverse order because of -r)
}<>
Riley
sumber
1

Pyth , 2 1 byte

z

Cobalah online!

Hanya mengeluarkan input. Membutuhkan string dalam tanda kutip.

-1 byte terima kasih kepada KarlKastor

Tidak Ada Di Sini
sumber
Bisakah kamu melakukannya +\"? ( \xchar literal + implisit Q)
ETHproduksi
@ETHproductions Bahkan lebih baik,+N
NoOneIsHere
Bagus, saya tidak terlalu mengenal Pyth :-)
ETHproduksi
1

Wortel , 1 byte

#

Bagaimana itu bekerja

# //Takes the input and places it onto the string stack
  //This is then output implicitly

{input} //The next program then consists of the input string
        //This is then placed directly onto the string stack
        //Then output implicitly

Alternatif, juga pada 1 byte adalah:

$

Ini berfungsi sama seperti di atas tetapi hanya mengambil input baris pertama. Melihat sebagai input hanya akan [A-Za-z0-9]baik-baik saja.

TheLethalCoder
sumber
Mengingat spec hanya mengklaim bahwa Anda perlu menangani AZ, az, dan 0-9, bukankah ini bersaing?
jkelm
@ jkelm Aku pasti melewatkan bagian itu, maka ya ini bersaing.
TheLethalCoder
Apakah ini akan berfungsi untuk input 01?
spaghetto
@ quartata Saya percaya begitu, sudah lama sejak saya menggunakan Carrot.
TheLethalCoder