Problem 14

17 comments on “Problem 14”


  • Sunny

    n=input()
    rev=[]
    for i in str(n):
    rev.append(i)
    reverse_final=rev[::-1]
    for i in range(len(reverse_final)):
    print(reverse_final[i],end=””)


  • Raman

    // Online C compiler to run C program online
    #include

    int main() {
    char s[100],p[100];
    int i=0,j,count=0;
    scanf(“%s”,s);
    while(s[i]!=’\0′){
    count++;
    i++;
    }
    j=0;
    while((count-1)>=0){
    p[j]=s[count-1];
    count–;
    j++;
    }
    j++;
    p[j]=’\0′;

    printf(“%s”,p);

    return 0;
    }


  • rohan

    #include
    int main()
    {
    int i;
    char n[10],temp[10];//ramsi
    gets(n);
    int l=strlen(n);//5
    for(i=0;i<l;++i)
    {
    temp[i]=n[l-i-1];
    }
    printf("%s\n%s",n,temp);
    }


  • Pogakula

    #python3
    def rev(s):
    final=”
    for i in range(-1,-len(s)-1,-1):
    final+=s[i]
    return final
    num=str(input())
    print(rev(num))


  • Richik

    another way using stack
    def revs(n):
    stack=[]
    stri=””
    for i in n:
    stack.append(i)
    for i in range(0,len(n)):
    stri+=(stack.pop())
    for i in stri:
    print(i,end=””)
    revs(input())


  • Sadique Gametor

    #include

    int main()
    {
    char a[100];
    scanf(“%[^\n]%*c”,a);
    int i,l=0;
    for(i=0;a[i]!=’\0′;i++)
    {
    l++;
    }

    for(i=l;i>=0;i–)
    {
    printf(“%c”,a[i]);
    }
    return 0;
    }


  • Promit

    #include
    int main()
    {
    char a[100],ch;
    int l,i;
    gets(a);
    for(l=0;a[l];l++);
    for(i=0;i<l/2;i++)
    {
    ch=a[i];
    a[i]=a[l-1-i];
    a[l-1-i]=ch;
    }
    puts(a);
    return 0;
    }


  • Shivam Garg

    public class reverse {
    public static void main(String[] args) throws IOException {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    String inp=br.readLine();
    for(int i=inp.length()-1;i>=0;i–)
    {
    System.out.print(“”+inp.charAt(i));
    }

    }
    }


  • clash of clan

    import java.util.Scanner;
    public class revno
    {
    public static void main(String args[])
    {
    int i,j,n,sum=0,k;
    Scanner sc=new Scanner(System.in);
    System.out.println(“Enter the no”);
    n=sc.nextInt();
    while(n!=0)
    {
    k=n%10;
    sum=sum*10+k;
    n=n/10;

    //System.out.println(sum);
    }
    System.out.println(sum);
    }
    }