Problem 31

8 comments on “Problem 31”


  • C VINAY

    for i in a:
    if i!=” “:
    print(i,end=””) elif i==” “:
    print() a=input()
    read_s(a)


  • sai

    import java.util.ArrayList;
    import java.util.List;

    public class S {
    public static void main(String[] args) {
    String s = “hi friends how are you”;
    int count = 0, k = 0;
    List a = new ArrayList();
    char c[] = s.toCharArray();
    for (int j = 0; j < s.length(); j++) {
    if (c[j] == ' ') {
    String z = s.substring(count, j);
    a.add(z);
    count = j + 1;
    }

    }
    System.out.println(a);
    }
    }


  • Gourav

    strr=’I am Gourav Raghuwanshi’
    l=[]
    s=”
    for ele in strr:
    if(ele==’ ‘):
    l.append(s)
    s=”
    else:
    s+=ele
    l.append(s)
    print(l)


  • amit

    #include

    int main()
    {
    char arr[100];
    int k;
    scanf(“%[^\n]%*c”,arr);
    k=strlen(arr);
    for(int i=0;i<k;i++)
    {
    if(arr[i]!=' ')
    printf("%c",arr[i]);
    else
    printf("\n");
    }
    return 0;
    }


  • Raman

    #python
    def read_s(a):
    for i in a:
    if i!=” “:
    print(i,end=””)

    elif i==” “:
    print()

    a=input()
    read_s(a)


  • Rahul

    import java.util.*;
    public class Main
    {
    public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    String big =”hello how are you?”;
    ArrayList list = new ArrayList();
    String temp =””;
    for(int i=0; i<big.length(); i++){
    char t =big.charAt(i);
    if( t == ' '){
    list.add(temp);
    temp ="";
    continue;
    }
    temp =temp + t;
    }
    list.add(temp);

    for(int j=0; j<list.size(); j++){
    System.out.println(list.get(j));
    }

    }
    }