From dd7b7f3344a33d4c8f1b6947e58eeb2ba02f84f3 Mon Sep 17 00:00:00 2001 From: Mohammad Sajid Anwar Date: Tue, 16 Jul 2024 11:53:17 +0100 Subject: - Added solutions by Eric Cheung. - Added solutions by Laurent Rosenfeld. - Added solutions by Mark Anderson. - Added solutions by Alexander Karelas. - Added solutions by Matthew Neleigh. - Added solutions by Feng Chang. - Added solutions by E. Choroba. - Added solutions by PokGoPun. - Added solutions by Steven Wilson. - Added solutions by Peter Meszaros. - Added solutions by Peter Campbell Smith. - Added solutions by David Ferrone. - Added solutions by Conor Hoekstra. - Added solutions by Thomas Kohler. - Added solutions by W. Luis Mochan. - Added solutions by Jaldhar H. Vyas. - Added solutions by Athanasius. - Added solutions by Robbie Hatley. - Added solutions by Luca Ferrari. --- challenge-278/eric-cheung/python/ch-2.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 challenge-278/eric-cheung/python/ch-2.py (limited to 'challenge-278/eric-cheung/python/ch-2.py') diff --git a/challenge-278/eric-cheung/python/ch-2.py b/challenge-278/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..e173d974d8 --- /dev/null +++ b/challenge-278/eric-cheung/python/ch-2.py @@ -0,0 +1,18 @@ + +## Example 1 +## strInput = "challenge" +## charInput = "e" + +## Example 2 +## strInput = "programming" +## charInput = "a" + +## Example 3 +strInput = "champion" +charInput = "b" + +if charInput in strInput: + nPos = strInput.find(charInput) + print ("".join(sorted(strInput[:nPos + 1])) + strInput[nPos + 1:]) +else: + print (strInput) -- cgit