+ 7
Question about Solution: Pig Latin
I carefully read the task - and even solved it in two ways (in C and Python), however, both of my solutions fail test # 3 without explaining the reason .... that is, I myself have to guess what’s there in some kind of test, which you came up with, could go wrong, and therefore fix something that would go wrong;) ... Your test should write an example of input, what went wrong ....... You (Dear the creators of this Task) can help me in this situation? Thanks.
13 odpowiedzi
+ 4
It seems like the third case has a word with a character not in the range [a, z] and different from a blank space, so your code splits that word in two when it shouldn't.
For example:
Input: hello#world
Output: ellohay#orldway
Expected (?): ello#worldhay
Change your first condition to
if (c != ' '):  # Not a blank space
and everything should work correctly.
+ 5
We, the community, can also help you. You can post your solution and someone will surely look into it.
+ 4
In C, the code is similar, only the output is not used immediately, but the char * array is being formed, and then it is printed.
+ 4
𝙁𝙖𝙧𝙝𝙖𝙣 🌀 🇧🇩 Here is a one liner
https://code.sololearn.com/cz8dF9nN8Wl8/?ref=app
+ 3
Diego: yes - that’s how it goes, damn it, but something else is written in the assignment:
Input Format 
A string of the sentence in English that you need to translate into Pig Latin. (no punctuation or capitalization)
+ 3
Farhan: Thanks. I already solved this problem, but your option is different ... Thank you.
+ 2
perhaps in the description of the problem, speaking of words, is it meant with the exception of prepositions?
+ 2
My code is shorter. 
Maybe this can also help you:
def solve(s):
    y=[]
    s=s.split(" ")
    for i in s:
        i=i+i[0]+"ay"
        y.append("".join(i[1:]))
    return " ".join(y)
print(solve(input()))
+ 1
text = input()
w=False
fcw = '0'
for c in text:
  if (c>='a' and c<='z'):
    if w == False:
      w = True
      fcw = c
    else:
      print(c,end="")
  else:
    if w == True:
       w = False
       print(fcw+"ay",end="")
    print(c,end="")
if w == True:
    w = False
    print(fcw+"ay",end="")
+ 1
Michail Getmanskiy Oh, thanks. There are many ways to solve a single problem.
+ 1
Michail Getmanskiy your code seemed a bit complex to me. That's why I posted a different way to solve that problem.
+ 1
//Using c++ check this out.. It works.. 
//#Daniel theProgrammer 
#include <iostream>
using namespace std;
int main() {
    string s, a, pig;
    getline(cin, s);
    for(int i = 0; s[i] != '\0'; i++){
        a += s[i];
        if(s[i+1] == ' ' || s[i+1] == '\0'){
        a = a.substr(1) + a[0] + "ay";
        pig += a + ' ';
        i++;
        a = "";
        }
    }
        cout << pig;
    return 0;
}









