El metro de Londres AKA The Tube es el ferrocarril subterráneo más antiguo del mundo, actualmente consta de once líneas * que dan servicio a 267 estaciones nombradas (estrictamente 269 ** estaciones desde que "Edgware Road" y "Hammersmith" ocupan dos ubicaciones)
El reto
Muestra los nombres de las líneas que dan servicio a una estación dada por nombre como entrada.
Entrada:
una cadena o lista de caracteres
Se puede suponer que se trata de un nombre de estación válido (como se indica en el bloque de código a continuación).
Puede suponer que cualquiera
&
en la entrada será consistentemente la palabraand
(oAnd
) en su lugar, si lo desea, simplemente dígalo claramente en su respuesta.
Salida: Salida
separada que enumera las de las once líneas que dan servicio a esa estación:
Una lista de cadenas, una lista de listas de caracteres, texto impreso, una cadena, una lista de caracteres; si tienes dudas pregunta.
Es posible que consistentemente salida de la palabra
and
(oAnd
) en lugar de cualquiera&
si lo desea, simplemente indicar claramente en su respuesta.Con la advertencia de que si imprime o devuelve una cadena o una lista de caracteres que la subcadena de separación utilizada no está presente en ninguno de los nombres de línea (incluidos los
&
oand
oAnd
utilizados), esto excluye el uso de un solo carácter de espacio como separador .
The Tube Network :
- Nota: este es el estado final, incluso si contiene un error ortográfico (a menos que se aborde antes de cualquier respuesta)
Input (Station Name) : Output (list of tube line names)
----------------------------------------------------------------------------------------------------------------
"Acton Town" : ["District","Piccadilly"]
"Aldgate" : ["Circle","Metropolitan"]
"Aldgate East" : ["District","Hammersmith & City"]
"Alperton" : ["Piccadilly"]
"Amersham" : ["Metropolitan"]
"Angel" : ["Northern"]
"Archway" : ["Northern"]
"Arnos Grove" : ["Piccadilly"]
"Arsenal" : ["Piccadilly"]
"Baker Street" : ["Bakerloo","Circle","Hammersmith & City","Jubilee","Metropolitan"]
"Balham" : ["Northern"]
"Bank" : ["Central","Northern","Waterloo & City"]
"Barbican" : ["Circle","Hammersmith & City","Metropolitan"]
"Barking" : ["District","Hammersmith & City"]
"Barkingside" : ["Central"]
"Barons Court" : ["District","Piccadilly"]
"Bayswater" : ["Circle","District"]
"Becontree" : ["District"]
"Belsize Park" : ["Northern"]
"Bermondsey" : ["Jubilee"]
"Bethnal Green" : ["Central"]
"Blackfriars" : ["Circle","District"]
"Blackhorse Road" : ["Victoria"]
"Bond Street" : ["Central","Jubilee"]
"Borough" : ["Northern"]
"Boston Manor" : ["Piccadilly"]
"Bounds Green" : ["Piccadilly"]
"Bow Road" : ["District","Hammersmith & City"]
"Brent Cross" : ["Northern"]
"Brixton" : ["Victoria"]
"Bromley-by-Bow" : ["District","Hammersmith & City"]
"Buckhurst Hill" : ["Central"]
"Burnt Oak" : ["Northern"]
"Caledonian Road" : ["Piccadilly"]
"Camden Town" : ["Northern"]
"Canada Water" : ["Jubilee"]
"Canary Wharf" : ["Jubilee"]
"Canning Town" : ["Jubilee"]
"Cannon Street" : ["Circle","District"]
"Canons Park" : ["Jubilee"]
"Chalfont & Latimer" : ["Metropolitan"]
"Chalk Farm" : ["Northern"]
"Chancery Lane" : ["Central"]
"Charing Cross" : ["Bakerloo","Northern"]
"Chesham" : ["Metropolitan"]
"Chigwell" : ["Central"]
"Chiswick Park" : ["District"]
"Chorleywood" : ["Metropolitan"]
"Clapham Common" : ["Northern"]
"Clapham North" : ["Northern"]
"Clapham South" : ["Northern"]
"Cockfosters" : ["Piccadilly"]
"Colindale" : ["Northern"]
"Colliers Wood" : ["Northern"]
"Covent Garden" : ["Piccadilly"]
"Croxley" : ["Metropolitan"]
"Dagenham East" : ["District"]
"Dagenham Heathway" : ["District"]
"Debden" : ["Central"]
"Dollis Hill" : ["Jubilee"]
"Ealing Broadway" : ["Central","District"]
"Ealing Common" : ["District","Piccadilly"]
"Earl's Court" : ["District","Piccadilly"]
"East Acton" : ["Central"]
"East Finchley" : ["Northern"]
"East Ham" : ["District","Hammersmith & City"]
"East Putney" : ["District"]
"Eastcote" : ["Metropolitan","Piccadilly"]
"Edgware" : ["Northern"]
"Edgware Road" : ["Bakerloo","Circle","District","Hammersmith & City"]
"Elephant & Castle" : ["Bakerloo","Northern"]
"Elm Park" : ["District"]
"Embankment" : ["Bakerloo","Circle","District","Northern"]
"Epping" : ["Central"]
"Euston" : ["Northern","Victoria"]
"Euston Square" : ["Circle","Hammersmith & City","Metropolitan"]
"Fairlop" : ["Central"]
"Farringdon" : ["Circle","Hammersmith & City","Metropolitan"]
"Finchley Central" : ["Northern"]
"Finchley Road" : ["Jubilee","Metropolitan"]
"Finsbury Park" : ["Piccadilly","Victoria"]
"Fulham Broadway" : ["District"]
"Gants Hill" : ["Central"]
"Gloucester Road" : ["Circle","District","Piccadilly"]
"Golders Green" : ["Northern"]
"Goldhawk Road" : ["Circle","Hammersmith & City"]
"Goodge Street" : ["Northern"]
"Grange Hill" : ["Central"]
"Great Portland Street" : ["Circle","Hammersmith & City","Metropolitan"]
"Greenford" : ["Central"]
"Green Park" : ["Jubilee","Piccadilly","Victoria"]
"Gunnersbury" : ["District"]
"Hainault" : ["Central"]
"Hammersmith" : ["Circle","District","Hammersmith & City","Piccadilly"]
"Hampstead" : ["Northern"]
"Hanger Lane" : ["Central"]
"Harlesden" : ["Bakerloo"]
"Harrow & Wealdstone" : ["Bakerloo"]
"Harrow-on-the-Hill" : ["Metropolitan"]
"Hatton Cross" : ["Piccadilly"]
"Heathrow Terminals 1, 2, 3" : ["Piccadilly"]
"Heathrow Terminal 4" : ["Piccadilly"]
"Heathrow Terminal 5" : ["Piccadilly"]
"Hendon Central" : ["Northern"]
"High Barnet" : ["Northern"]
"Highbury & Islington" : ["Victoria"]
"Highgate" : ["Northern"]
"High Street Kensington" : ["Circle","District"]
"Hillingdon" : ["Metropolitan","Piccadilly"]
"Holborn" : ["Central","Piccadilly"]
"Holland Park" : ["Central"]
"Holloway Road" : ["Piccadilly"]
"Hornchurch" : ["District"]
"Hounslow Central" : ["Piccadilly"]
"Hounslow East" : ["Piccadilly"]
"Hounslow West" : ["Piccadilly"]
"Hyde Park Corner" : ["Piccadilly"]
"Ickenham" : ["Metropolitan","Piccadilly"]
"Kennington" : ["Northern"]
"Kensal Green" : ["Bakerloo"]
"Kensington (Olympia)" : ["District"]
"Kentish Town" : ["Northern"]
"Kenton" : ["Bakerloo"]
"Kew Gardens" : ["District"]
"Kilburn" : ["Jubilee"]
"Kilburn Park" : ["Bakerloo"]
"Kingsbury" : ["Jubilee"]
"King's Cross St. Pancras" : ["Circle","Hammersmith & City","Metropolitan","Northern","Piccadilly","Victoria"]
"Knightsbridge" : ["Piccadilly"]
"Ladbroke Grove" : ["Circle","Hammersmith & City"]
"Lambeth North" : ["Bakerloo"]
"Lancaster Gate" : ["Central"]
"Latimer Road" : ["Circle","Hammersmith & City"]
"Leicester Square" : ["Northern","Piccadilly"]
"Leyton" : ["Central"]
"Leytonstone" : ["Central"]
"Liverpool Street" : ["Central","Circle","Hammersmith & City","Metropolitan"]
"London Bridge" : ["Jubilee","Northern"]
"Loughton" : ["Central"]
"Maida Vale" : ["Bakerloo"]
"Manor House" : ["Piccadilly"]
"Mansion House" : ["Circle","District"]
"Marble Arch" : ["Central"]
"Marylebone" : ["Bakerloo"]
"Mile End" : ["Central","District","Hammersmith & City"]
"Mill Hill East" : ["Northern"]
"Monument" : ["Circle","District"]
"Moorgate" : ["Circle","Hammersmith & City","Metropolitan","Northern"]
"Moor Park" : ["Metropolitan"]
"Morden" : ["Northern"]
"Mornington Crescent" : ["Northern"]
"Neasden" : ["Jubilee"]
"Newbury Park" : ["Central"]
"North Acton" : ["Central"]
"North Ealing" : ["Piccadilly"]
"North Greenwich" : ["Jubilee"]
"North Harrow" : ["Metropolitan"]
"North Wembley" : ["Bakerloo"]
"Northfields" : ["Piccadilly"]
"Northolt" : ["Central"]
"Northwick Park" : ["Metropolitan"]
"Northwood" : ["Metropolitan"]
"Northwood Hills" : ["Metropolitan"]
"Notting Hill Gate" : ["Central","Circle","District"]
"Oakwood" : ["Piccadilly"]
"Old Street" : ["Northern"]
"Osterley" : ["Piccadilly"]
"Oval" : ["Northern"]
"Oxford Circus" : ["Bakerloo","Central","Victoria"]
"Paddington" : ["Bakerloo","Circle","District","Hammersmith & City"]
"Park Royal" : ["Piccadilly"]
"Parsons Green" : ["District"]
"Perivale" : ["Central"]
"Piccadilly Circus" : ["Bakerloo","Piccadilly"]
"Pimlico" : ["Victoria"]
"Pinner" : ["Metropolitan"]
"Plaistow" : ["District","Hammersmith & City"]
"Preston Road" : ["Metropolitan"]
"Putney Bridge" : ["District"]
"Queen's Park" : ["Bakerloo"]
"Queensbury" : ["Jubilee"]
"Queensway" : ["Central"]
"Ravenscourt Park" : ["District"]
"Rayners Lane" : ["Metropolitan","Piccadilly"]
"Redbridge" : ["Central"]
"Regent's Park" : ["Bakerloo"]
"Richmond" : ["District"]
"Rickmansworth" : ["Metropolitan"]
"Roding Valley" : ["Central"]
"Royal Oak" : ["Circle","Hammersmith & City"]
"Ruislip" : ["Metropolitan","Piccadilly"]
"Ruislip Gardens" : ["Central"]
"Ruislip Manor" : ["Metropolitan","Piccadilly"]
"Russell Square" : ["Piccadilly"]
"St. James's Park" : ["Circle","District"]
"St. John's Wood" : ["Jubilee"]
"St. Paul's" : ["Central"]
"Seven Sisters" : ["Victoria"]
"Shepherd's Bush" : ["Central"]
"Shepherd's Bush Market" : ["Circle","Hammersmith & City"]
"Sloane Square" : ["Circle","District"]
"Snaresbrook" : ["Central"]
"South Ealing" : ["Piccadilly"]
"South Harrow" : ["Piccadilly"]
"South Kensington" : ["Circle","District","Piccadilly"]
"South Kenton" : ["Bakerloo"]
"South Ruislip" : ["Central"]
"South Wimbledon" : ["Northern"]
"South Woodford" : ["Central"]
"Southfields" : ["District"]
"Southgate" : ["Piccadilly"]
"Southwark" : ["Jubilee"]
"Stamford Brook" : ["District"]
"Stanmore" : ["Jubilee"]
"Stepney Green" : ["District","Hammersmith & City"]
"Stockwell" : ["Northern","Victoria"]
"Stonebridge Park" : ["Bakerloo"]
"Stratford" : ["Central","Jubilee"]
"Sudbury Hill" : ["Piccadilly"]
"Sudbury Town" : ["Piccadilly"]
"Swiss Cottage" : ["Jubilee"]
"Temple" : ["Circle","District"]
"Theydon Bois" : ["Central"]
"Tooting Bec" : ["Northern"]
"Tooting Broadway" : ["Northern"]
"Tottenham Court Road" : ["Central","Northern"]
"Tottenham Hale" : ["Victoria"]
"Totteridge & Whetstone" : ["Northern"]
"Tower Hill" : ["Circle","District"]
"Tufnell Park" : ["Northern"]
"Turnham Green" : ["District","Piccadilly"]
"Turnpike Lane" : ["Piccadilly"]
"Upminster" : ["District"]
"Upminster Bridge" : ["District"]
"Upney" : ["District"]
"Upton Park" : ["District","Hammersmith & City"]
"Uxbridge" : ["Metropolitan","Piccadilly"]
"Vauxhall" : ["Victoria"]
"Victoria" : ["Circle","District","Victoria"]
"Walthamstow Central" : ["Victoria"]
"Wanstead" : ["Central"]
"Warren Street" : ["Northern","Victoria"]
"Warwick Avenue" : ["Bakerloo"]
"Waterloo" : ["Bakerloo","Jubilee","Northern","Waterloo & City"]
"Watford" : ["Metropolitan"]
"Wembley Central" : ["Bakerloo"]
"Wembley Park" : ["Jubilee","Metropolitan"]
"West Acton" : ["Central"]
"West Brompton" : ["District"]
"West Finchley" : ["Northern"]
"West Ham" : ["District","Hammersmith & City","Jubilee"]
"West Hampstead" : ["Jubilee"]
"West Harrow" : ["Metropolitan"]
"West Kensington" : ["District"]
"West Ruislip" : ["Central"]
"Westbourne Park" : ["Circle","Hammersmith & City"]
"Westminster" : ["Circle","District","Jubilee"]
"White City" : ["Central"]
"Whitechapel" : ["District","Hammersmith & City"]
"Willesden Green" : ["Jubilee"]
"Willesden Junction" : ["Bakerloo"]
"Wimbledon" : ["District"]
"Wimbledon Park" : ["District"]
"Wood Green" : ["Piccadilly"]
"Wood Lane" : ["Circle","Hammersmith & City"]
"Woodford" : ["Central"]
"Woodside Park" : ["Northern"]
... los once nombres de línea son:
Bakerloo
Central
Circle
District
Hammersmith & City
Jubilee
Metropolitan
Northern
Piccadilly
Victoria
Waterloo & City
* Transporte Para Londres también gestiona otras líneas de tren, algunas también pueden denominarse parte de "The Tube" (muy probablemente el "Docklands Light Railway" o "DLR"), pero nos quedaremos con las once enumeradas aquí.
** La página de Wikipedia vinculada actualmente indica 270, pero creo que están contando por error la segunda ubicación de Canary Wharf a pesar de que solo da servicio al "DLR")
¡Montones de puntos de brownie imaginarios (y muy probablemente muchos votos a favor también) para una presentación de golf usando Mornington Crescent (un IDE compatible está disponible aquí )!
Este es el código de golf , por lo que el código más corto en bytes gana por idioma y la solución más corta gana (no permita que los idiomas de golf lo desanimen en otros idiomas). ¡Que te diviertas!