Die Londoner U-Bahn AKA The Tube ist die älteste U-Bahn der Welt und besteht derzeit aus elf Linien *, die 267 benannte Stationen bedienen (streng 269 ** Stationen, da "Edgware Road" und "Hammersmith" jeweils zwei Standorte belegen).
Die Herausforderung
Geben Sie die Namen der Leitungen aus, die eine Station bedienen, die durch den Namen als Eingabe angegeben wird.
Eingabe:
Eine Zeichenfolge oder eine Liste von Zeichen
Es kann angenommen werden, dass dies ein gültiger Stationsname ist (wie im folgenden Codeblock aufgeführt).
Sie können davon ausgehen, dass jedes Wort
&
in der Eingabe durchweg das Wortand
(oderAnd
) ist. Geben Sie dies in Ihrer Antwort einfach klar an.
Ausgabe:
Getrennte Ausgabe, in der die elf Leitungen aufgeführt sind, die diese Station bedienen:
Eine Liste von Zeichenfolgen, eine Liste von Zeichenlisten, gedruckter Text, eine Zeichenfolge, eine Liste von Zeichen; im Zweifelsfall fragen.
Wenn Sie möchten, können Sie das Wort (oder ) durchgehend anstelle eines anderen ausgeben. Geben Sie dies einfach in Ihrer Antwort deutlich an.
and
And
&
Mit dem Vorbehalt, dass beim Drucken oder Zurückgeben einer Zeichenfolge oder einer Liste von Zeichen, die der verwendete Trennzeichen-Teilstring in keinem der Zeilennamen (einschließlich des
&
oderand
oderAnd
) enthält, die Verwendung eines einzelnen Leerzeichens als Trennzeichen ausgeschlossen ist .
Das U-Bahn-Netzwerk :
- Hinweis: Dies ist der endgültige Status, auch wenn er einen Rechtschreibfehler enthält (sofern er nicht vor einer Antwort angesprochen wurde).
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"]
... die elf Zeilennamen sind:
Bakerloo
Central
Circle
District
Hammersmith & City
Jubilee
Metropolitan
Northern
Piccadilly
Victoria
Waterloo & City
* Transport Für London werden auch andere Bahnlinien verwaltet, einige werden möglicherweise auch als Teil von "The Tube" (höchstwahrscheinlich "Docklands Light Railway" oder "DLR") bezeichnet, aber wir werden uns an die hier aufgeführten elf halten.
** Auf der verlinkten Wikipedia-Seite stehen derzeit 270, aber ich glaube, sie zählen fälschlicherweise den zweiten Standort von Canary Wharf, obwohl er nur das "DLR" bedient.)
Jede Menge imaginärer Brownie-Punkte (und höchstwahrscheinlich auch viele Upvotes) für eine Golf-Einsendung mit Mornington Crescent (eine kompatible IDE finden Sie hier )!
Dies ist Code-Golf , also gewinnt der kürzeste Code in Bytes pro Sprache und die kürzeste Lösung (lassen Sie sich von Golfsprachen nicht davon abhalten, in anderen Sprachen Golf zu spielen). Habe Spaß!