Untitled

 avatar
unknown
c_cpp
3 years ago
1.1 kB
6
Indexable
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <iostream>
using namespace std;

void reverse(string str[], int i, int size){

    string rev = "";

    for(int j=0; j<size; j++)
    {
        for(int i=str[j].length()-1; i>=0; i--)
    {
        rev = rev + str[j][i];  
    }
    
        cout << rev << endl;

    }
    
}
 
int main()
{   
    string words[10];
    int num, length;
    char ch;
    cin>> num;
    for(int i=0; i<num; i++)
    {
        cin>>length;
        for(int j=0; j<length; j++)
        {
            cin>>ch;
            words[i]=words[i]+ch;
        }
    }
    
    for(int i=0; i<num ;i++)
    {
        reverse(words[i], 0, num);
    }
    return 0;
}
Editor is loading...